file(GLOB_RECURSE USB4JAVA_SOURCES *.c)
add_library(usb4java SHARED ${USB4JAVA_SOURCES})
target_link_libraries(usb4java ${LibUsb_LIBRARIES})
install(TARGETS usb4java DESTINATION lib)

file(GLOB_RECURSE USB4JAVA_SOURCES *.c)
add_library(usb4java SHARED ${USB4JAVA_SOURCES})
target_link_libraries(usb4java ${LibUsb_LIBRARIES})
if(CMAKE_COMPILER_IS_GNUCC)
  set_target_properties(usb4java PROPERTIES LINK_FLAGS -static-libgcc)
endif()
install(TARGETS usb4java DESTINATION lib)

Use -static-libgcc linker option when using gcc
Use -static-libgcc linker option when using gcc
