Don't statically link libgcc, and don't use GCC/Clang flags on MSVC when cross-compiling for windows
This commit is contained in:
parent
66af9b9e2b
commit
4b0e58dd6a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue