Skip to content

Commit fa2da0b

Browse files
committed
Windows: Link statically
1 parent 13b420b commit fa2da0b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ endmacro(use_c99)
3131

3232
use_c99()
3333

34+
IF (WIN32)
35+
set(CMAKE_C_STANDARD_LIBRARIES "-lsetupapi -static-libgcc -static-libstdc++ -lwsock32 -lws2_32 ${CMAKE_CXX_STANDARD_LIBRARIES}")
36+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
37+
ENDIF()
38+
3439
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
3540
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3641

cmake_modules/Findhidapi.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
IF (WIN32)
2727
find_library(HIDAPI_LIBRARY
28-
NAMES hidapi)
28+
NAMES hidapi.a libhidapi.a hidapi)
2929
ELSE()
3030
find_library(HIDAPI_LIBRARY
3131
NAMES hidapi-hidraw hidapi)

0 commit comments

Comments
 (0)