Skip to content

Commit 0474c59

Browse files
authored
Update CMake with some additional switches (#304)
1 parent c1dfc83 commit 0474c59

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: branch_classification
2+
description: Branch classification configuration for repository
3+
resource: repository
4+
disabled: false
5+
where:
6+
configuration:
7+
branchClassificationSettings:
8+
defaultClassification: nonproduction
9+
ruleset:
10+
- name: prod-branches
11+
branchNames:
12+
- main
13+
- ms_sdk_release
14+
- release
15+
classification: production

SHMath/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ if(WIN32 AND BUILD_DX12)
6969
set(LIBRARY_SOURCES ${LIBRARY_SOURCES} DirectXSHD3D12.cpp)
7070
endif()
7171

72-
add_library(${PROJECT_NAME} STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
72+
add_library(${PROJECT_NAME} STATIC)
73+
74+
target_sources(${PROJECT_NAME} PRIVATE ${LIBRARY_HEADERS} ${LIBRARY_SOURCES})
7375

7476
target_include_directories(${PROJECT_NAME} PUBLIC
7577
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@@ -129,7 +131,7 @@ install(FILES
129131

130132
#--- Compiler switches
131133
if(MSVC)
132-
target_compile_options(${PROJECT_NAME} PRIVATE /Wall /EHsc /GR "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
134+
target_compile_options(${PROJECT_NAME} PRIVATE /Wall /EHsc /GR /Gd /GS /Zc:forScope /Zc:inline /Zc:wchar_t "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
133135

134136
if((MSVC_VERSION GREATER_EQUAL 1928)
135137
AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -164,7 +166,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
164166
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161)
165167
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
166168
target_compile_options(${PROJECT_NAME} PRIVATE
167-
/sdl /Zc:forScope /Zc:inline /Zc:wchar_t /fp:fast
169+
/sdl /fp:fast
168170
/wd4061 /wd4365 /wd4514 /wd4571 /wd4668 /wd4710 /wd4820 /wd5039 /wd5045)
169171

170172
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
@@ -179,6 +181,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
179181
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:__cplusplus)
180182
endif()
181183

184+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.15)
185+
target_compile_options(${PROJECT_NAME} PRIVATE /JMC-)
186+
endif()
187+
182188
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
183189
target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256)
184190
endif()
@@ -210,6 +216,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
210216

211217
target_compile_options(${PROJECT_NAME} PRIVATE $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
212218
endif()
219+
220+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.50)
221+
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:u8EscapeEncoding)
222+
endif()
213223
endif()
214224

215225
if((NOT WIN32) AND (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/sal/sal.h"))

0 commit comments

Comments
 (0)