There is no reason to enable it by default. Looks like it was done for
enabling it to run with wine.
CC: x86_64-w64-mingw32-gcc-posix
CXX: x86_64-w64-mingw32-g++-posix
ENABLE_CACHE_CLEANUP_TESTS: 1
- CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON
+ CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DCMAKE_SYSTEM_NAME=Windows -DZSTD_FROM_INTERNET=ON -DSTATIC_LINK=ON
RUN_TESTS: unittest-in-wine
apt_get: elfutils mingw-w64 wine
include(CodeAnalysis)
option(ENABLE_TRACING "Enable possibility to use internal ccache tracing" OFF)
+if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ option(STATIC_LINK "Link statically with system libraries" OFF)
+endif()
+
#
# Source code
#
target_link_libraries(ccache_lib PRIVATE ws2_32 "psapi")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- target_link_libraries(
- ccache_lib PRIVATE -static gcc stdc++ winpthread -dynamic)
- elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ if(STATIC_LINK)
+ target_link_libraries(ccache_lib PRIVATE -static-libgcc -static-libstdc++ -static winpthread -dynamic)
+ else()
+ target_link_libraries(ccache_lib PRIVATE winpthread)
+ endif()
+ elseif(STATIC_LINK AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_libraries(ccache_lib PRIVATE -static c++ -dynamic)
endif()
endif()