From 2580f72591c5221f8a4e350584d19afbfd69a8ca Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 12 Apr 2023 17:41:56 +0100 Subject: [PATCH] CMake: Link libgcc/libstdc++ statically Fixes missing DLLs on Windows --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 601305f..bc03a1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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)