diff --git a/CMakeLists.txt b/CMakeLists.txt index e69fce3..88eeeb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,11 +33,10 @@ set(MINIMAL_CLANG "13.0") if (NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") - set(CMAKE_CXX_FLAGS_RELEASE "-Os") endif() +set(CMAKE_CXX_FLAGS_RELEASE "-Os") if ((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc") set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -pipe -fstack-protector-strong -fstack-clash-protection -fexceptions") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fmerge-all-constants -ftree-vectorize") include(CheckCXXCompilerFlag) @@ -151,7 +150,9 @@ elseif(MINGW OR MSVC) set(CMAKE_INSTALL_PREFIX "C:\\progs\\${PROJECT_NAME}") set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CODENAME}) set(CPACK_NSIS_INSTALL_ROOT "${CMAKE_INSTALL_PREFIX}") - set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++ ${CMAKE_EXE_LINKER_FLAGS}") + if (MINGW) + set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++ -static-libgcc ${CMAKE_EXE_LINKER_FLAGS}") + endif() set(CPACK_PACKAGE_FILE_NAME "${PNAME}_wpkg") set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") set(CPACK_NSIS_MANIFEST_DPI_AWARE true)