diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e23594..50c7df0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,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 @@ -198,15 +206,19 @@ if(BUILD_TOOLS AND WIN32 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 WIN32 AND (NOT WINDOWS_STORE)) - target_compile_options(uvatlastool PRIVATE /fp:fast) + target_compile_options(uvatlastool PRIVATE /fp:fast "$<$>:/guard:cf>") + target_link_options(uvatlastool PRIVATE /DYNAMICBASE /NXCOMPAT) endif() if((${CMAKE_SIZEOF_VOID_P} EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "arm")) target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2) + if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE)) target_compile_options(uvatlastool PRIVATE /arch:SSE2) + target_link_options(uvatlastool PRIVATE /SAFESEH) endif() endif() endif() @@ -221,10 +233,10 @@ 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 WIN32 AND (NOT WINDOWS_STORE)) - target_compile_options(uvatlastool PRIVATE /permissive- /Zc:__cplusplus) + target_compile_options(uvatlastool PRIVATE /sdl /permissive- /Zc:__cplusplus) endif() if(ENABLE_CODE_ANALYSIS)