Skip to content

Commit

Permalink
Windows: Link statically
Browse files Browse the repository at this point in the history
  • Loading branch information
Sapd committed Oct 24, 2021
1 parent 13b420b commit fa2da0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ endmacro(use_c99)

use_c99()

IF (WIN32)
set(CMAKE_C_STANDARD_LIBRARIES "-lsetupapi -static-libgcc -static-libstdc++ -lwsock32 -lws2_32 ${CMAKE_CXX_STANDARD_LIBRARIES}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
ENDIF()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
2 changes: 1 addition & 1 deletion cmake_modules/Findhidapi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

IF (WIN32)
find_library(HIDAPI_LIBRARY
NAMES hidapi)
NAMES hidapi.a libhidapi.a hidapi)
ELSE()
find_library(HIDAPI_LIBRARY
NAMES hidapi-hidraw hidapi)
Expand Down

0 comments on commit fa2da0b

Please sign in to comment.