diff --git a/CMakeLists.txt b/CMakeLists.txt index d65a9b5..39334f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") if (DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") + set(DIRECTX_ARCH x86) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + set(DIRECTX_ARCH x64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + set(DIRECTX_ARCH arm) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") + set(DIRECTX_ARCH arm64) endif() #--- Library @@ -270,15 +278,19 @@ if(BUILD_TOOLS AND (NOT WINDOWS_STORE)) endif() if(MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast) + target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast "$<$>:/guard:cf>") + if(BUILD_TOOLS AND (NOT WINDOWS_STORE)) - target_compile_options(xwbtool PRIVATE /fp:fast) + target_compile_options(xwbtool PRIVATE /fp:fast "$<$>:/guard:cf>") endif() if((${CMAKE_SIZEOF_VOID_P} EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "arm")) target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2) + target_link_options(${PROJECT_NAME} PRIVATE /SAFESEH) + if(BUILD_TOOLS AND (NOT WINDOWS_STORE)) target_compile_options(xwbtool PRIVATE /arch:SSE2) + target_link_options(xwbtool PRIVATE /SAFESEH) endif() endif() endif() @@ -295,9 +307,9 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) endif() endif() if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) - target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus) + target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus) if(BUILD_TOOLS AND (NOT WINDOWS_STORE)) - target_compile_options(xwbtool PRIVATE /permissive- /Zc:__cplusplus) + target_compile_options(xwbtool PRIVATE /sdl /permissive- /Zc:__cplusplus) endif() if(ENABLE_CODE_ANALYSIS)