Add NO_WCHAR_T build option to CMake (#384)

This commit is contained in:
Chuck Walbourn
2023-08-20 11:01:09 -07:00
committed by GitHub
parent 1d1d4d0134
commit 0abc33330b
8 changed files with 236 additions and 17 deletions

View File

@@ -37,6 +37,8 @@ option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" OFF)
option(USE_PREBUILT_SHADERS "Use externally built HLSL shaders" OFF)
option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF)
# Includes the functions for loading/saving OpenEXR files at runtime
option(ENABLE_OPENEXR_SUPPORT "Build with OpenEXR support" OFF)
@@ -399,6 +401,13 @@ if(MSVC)
target_link_options(${t} PRIVATE "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
endforeach()
endif()
if(NO_WCHAR_T)
message(STATUS "Using non-native wchar_t as unsigned short")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "/Zc:wchar_t-")
endforeach()
endif()
else()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_definitions(${t} PRIVATE $<IF:$<CONFIG:DEBUG>,_DEBUG,NDEBUG>)