Skip to content

Commit

Permalink
CMake: Link libgcc/libstdc++ statically
Browse files Browse the repository at this point in the history
Fixes missing DLLs on Windows
  • Loading branch information
glebm authored Apr 12, 2023
1 parent 2abbcb5 commit 2580f72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ target_link_libraries(clx2pixels PUBLIC common clx_decode)
set_target_properties(clx2pixels PROPERTIES PUBLIC_HEADER "src/public/include/clx2pixels.hpp")
target_include_directories(clx2pixels PRIVATE src/internal)

foreach(_target cel2clx_main cl22clx_main pcx2clx_main)
foreach(_target cel2clx_main cl22clx_main clx2pcx_main pcx2clx_main)
if(ASAN)
target_compile_options(${_target} PUBLIC -fsanitize=address -fsanitize-recover=address)
target_link_libraries(${_target} PUBLIC -fsanitize=address -fsanitize-recover=address)
Expand All @@ -162,6 +162,10 @@ foreach(_target cel2clx_main cl22clx_main pcx2clx_main)
target_compile_options(${_target} PUBLIC -fsanitize=undefined)
target_link_libraries(${_target} PUBLIC -fsanitize=undefined)
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_link_libraries(${_target} PUBLIC "-static-libgcc -static-libstdc++")
endif()
endforeach()

if(ENABLE_INSTALL)
Expand Down

0 comments on commit 2580f72

Please sign in to comment.