mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 15:12:31 +00:00
stage1: override cmake's default compilation flags to statically link the CRT on windows
we want to use /MT instead of /MD for a fully static executable
This commit is contained in:
parent
700bb19a90
commit
5b51f41cee
@ -10,10 +10,14 @@ if(NOT CMAKE_INSTALL_PREFIX)
|
||||
"Directory to install zig to" FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
|
||||
|
||||
project(zig C CXX)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
|
||||
set(ZIG_VERSION_MAJOR 0)
|
||||
set(ZIG_VERSION_MINOR 5)
|
||||
set(ZIG_VERSION_PATCH 0)
|
||||
|
13
cmake/c_flag_overrides.cmake
Normal file
13
cmake/c_flag_overrides.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT
|
||||
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL_INIT
|
||||
"/MT /O1 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE_INIT
|
||||
"/MT /O2 /Ob2 /D NDEBUG")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT
|
||||
"/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif()
|
13
cmake/cxx_flag_overrides.cmake
Normal file
13
cmake/cxx_flag_overrides.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG_INIT
|
||||
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT
|
||||
"/MT /O1 /Ob1 /D NDEBUG")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE_INIT
|
||||
"/MT /O2 /Ob2 /D NDEBUG")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
|
||||
"/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user