From ba3978c41909266598e6ccb31d127b8f6073ebcf Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 2 Dec 2022 23:13:43 -0800 Subject: [PATCH] Minor cmake code review --- BasicCompute11/CMakeLists.txt | 19 ++++++++++--------- BasicHLSL11/CMakeLists.txt | 19 ++++++++++--------- BasicHLSLFX11/CMakeLists.txt | 19 ++++++++++--------- ComputeShaderSort11/CMakeLists.txt | 19 ++++++++++--------- Direct3D11Tutorials/Tutorial01/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial02/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial03/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial04/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial05/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial06/CMakeLists.txt | 3 ++- Direct3D11Tutorials/Tutorial07/CMakeLists.txt | 3 ++- .../Tutorial08/CMakeLists.txt | 3 ++- .../Tutorial09/CMakeLists.txt | 3 ++- .../Tutorial10/CMakeLists.txt | 3 ++- .../Tutorial11/CMakeLists.txt | 3 ++- .../Tutorial12/CMakeLists.txt | 3 ++- .../Tutorial13/CMakeLists.txt | 3 ++- .../Tutorial14/CMakeLists.txt | 3 ++- EmptyProject11/CMakeLists.txt | 19 ++++++++++--------- SimpleBezier11/CMakeLists.txt | 19 ++++++++++--------- SimpleSample11/CMakeLists.txt | 19 ++++++++++--------- 21 files changed, 98 insertions(+), 77 deletions(-) diff --git a/BasicCompute11/CMakeLists.txt b/BasicCompute11/CMakeLists.txt index 0172cf71..ebcd5938 100644 --- a/BasicCompute11/CMakeLists.txt +++ b/BasicCompute11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -48,10 +48,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -60,7 +62,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -68,27 +70,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-float-equal") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/BasicHLSL11/CMakeLists.txt b/BasicHLSL11/CMakeLists.txt index f73362f0..c0a29bb1 100644 --- a/BasicHLSL11/CMakeLists.txt +++ b/BasicHLSL11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -56,10 +56,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -68,7 +70,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -76,27 +78,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/BasicHLSLFX11/CMakeLists.txt b/BasicHLSLFX11/CMakeLists.txt index 37e5c887..690cfea0 100644 --- a/BasicHLSLFX11/CMakeLists.txt +++ b/BasicHLSLFX11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -59,10 +59,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -71,7 +73,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -79,27 +81,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/ComputeShaderSort11/CMakeLists.txt b/ComputeShaderSort11/CMakeLists.txt index b7cd47fd..634d0ba5 100644 --- a/ComputeShaderSort11/CMakeLists.txt +++ b/ComputeShaderSort11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -48,10 +48,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -60,7 +62,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -68,27 +70,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-float-equal") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/Direct3D11Tutorials/Tutorial01/CMakeLists.txt b/Direct3D11Tutorials/Tutorial01/CMakeLists.txt index c8e70d99..5bab487c 100644 --- a/Direct3D11Tutorials/Tutorial01/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial01/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial02/CMakeLists.txt b/Direct3D11Tutorials/Tutorial02/CMakeLists.txt index 34b8aa89..0b9f98bf 100644 --- a/Direct3D11Tutorials/Tutorial02/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial02/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial03/CMakeLists.txt b/Direct3D11Tutorials/Tutorial03/CMakeLists.txt index f08193cb..546c47b5 100644 --- a/Direct3D11Tutorials/Tutorial03/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial03/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial04/CMakeLists.txt b/Direct3D11Tutorials/Tutorial04/CMakeLists.txt index 8e32fe03..6e02a307 100644 --- a/Direct3D11Tutorials/Tutorial04/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial04/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial05/CMakeLists.txt b/Direct3D11Tutorials/Tutorial05/CMakeLists.txt index 576a4c50..5b839214 100644 --- a/Direct3D11Tutorials/Tutorial05/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial05/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial06/CMakeLists.txt b/Direct3D11Tutorials/Tutorial06/CMakeLists.txt index 36b4f415..2545a770 100644 --- a/Direct3D11Tutorials/Tutorial06/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial06/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11Tutorials/Tutorial07/CMakeLists.txt b/Direct3D11Tutorials/Tutorial07/CMakeLists.txt index fa7125b3..bf3cb83c 100644 --- a/Direct3D11Tutorials/Tutorial07/CMakeLists.txt +++ b/Direct3D11Tutorials/Tutorial07/CMakeLists.txt @@ -58,6 +58,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -78,7 +80,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsDXUT/Tutorial08/CMakeLists.txt b/Direct3D11TutorialsDXUT/Tutorial08/CMakeLists.txt index ecdd4ddd..1c9d7f52 100644 --- a/Direct3D11TutorialsDXUT/Tutorial08/CMakeLists.txt +++ b/Direct3D11TutorialsDXUT/Tutorial08/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsDXUT/Tutorial09/CMakeLists.txt b/Direct3D11TutorialsDXUT/Tutorial09/CMakeLists.txt index eca9c7b7..b0889c6b 100644 --- a/Direct3D11TutorialsDXUT/Tutorial09/CMakeLists.txt +++ b/Direct3D11TutorialsDXUT/Tutorial09/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsDXUT/Tutorial10/CMakeLists.txt b/Direct3D11TutorialsDXUT/Tutorial10/CMakeLists.txt index c843cabf..45b4d173 100644 --- a/Direct3D11TutorialsDXUT/Tutorial10/CMakeLists.txt +++ b/Direct3D11TutorialsDXUT/Tutorial10/CMakeLists.txt @@ -56,6 +56,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -76,7 +78,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsFX11/Tutorial11/CMakeLists.txt b/Direct3D11TutorialsFX11/Tutorial11/CMakeLists.txt index 6db6779f..ed432f4b 100644 --- a/Direct3D11TutorialsFX11/Tutorial11/CMakeLists.txt +++ b/Direct3D11TutorialsFX11/Tutorial11/CMakeLists.txt @@ -59,6 +59,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -79,7 +81,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsFX11/Tutorial12/CMakeLists.txt b/Direct3D11TutorialsFX11/Tutorial12/CMakeLists.txt index f0726b68..47af2c1e 100644 --- a/Direct3D11TutorialsFX11/Tutorial12/CMakeLists.txt +++ b/Direct3D11TutorialsFX11/Tutorial12/CMakeLists.txt @@ -59,6 +59,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -79,7 +81,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsFX11/Tutorial13/CMakeLists.txt b/Direct3D11TutorialsFX11/Tutorial13/CMakeLists.txt index 4a1e74c4..51430d6a 100644 --- a/Direct3D11TutorialsFX11/Tutorial13/CMakeLists.txt +++ b/Direct3D11TutorialsFX11/Tutorial13/CMakeLists.txt @@ -59,6 +59,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -79,7 +81,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/Direct3D11TutorialsFX11/Tutorial14/CMakeLists.txt b/Direct3D11TutorialsFX11/Tutorial14/CMakeLists.txt index 9cf92f73..1a1e5b93 100644 --- a/Direct3D11TutorialsFX11/Tutorial14/CMakeLists.txt +++ b/Direct3D11TutorialsFX11/Tutorial14/CMakeLists.txt @@ -59,6 +59,8 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") @@ -79,7 +81,6 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) diff --git a/EmptyProject11/CMakeLists.txt b/EmptyProject11/CMakeLists.txt index 14e473bc..3fab561d 100644 --- a/EmptyProject11/CMakeLists.txt +++ b/EmptyProject11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -56,10 +56,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -68,7 +70,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -76,27 +78,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/SimpleBezier11/CMakeLists.txt b/SimpleBezier11/CMakeLists.txt index d383b152..4ceda2b3 100644 --- a/SimpleBezier11/CMakeLists.txt +++ b/SimpleBezier11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -56,10 +56,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -68,7 +70,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -76,27 +78,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt" "-Wno-double-promotion") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif() diff --git a/SimpleSample11/CMakeLists.txt b/SimpleSample11/CMakeLists.txt index 8cc53dbc..ce1de2bf 100644 --- a/SimpleSample11/CMakeLists.txt +++ b/SimpleSample11/CMakeLists.txt @@ -15,7 +15,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/CMake") set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release) -if (DEFINED VCPKG_TARGET_ARCHITECTURE) +if(DEFINED VCPKG_TARGET_ARCHITECTURE) set(DIRECTX_ARCH ${VCPKG_TARGET_ARCHITECTURE}) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") set(DIRECTX_ARCH x86) @@ -56,10 +56,12 @@ if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") target_link_options(${PROJECT_NAME} PRIVATE "$<$>:/guard:ehcont>") endif() +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) endif() if(NOT ${DIRECTX_ARCH} MATCHES "^arm") - if (${CMAKE_SIZEOF_VOID_P} EQUAL "4") + if(${CMAKE_SIZEOF_VOID_P} EQUAL "4") set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>) @@ -68,7 +70,7 @@ if(NOT ${DIRECTX_ARCH} MATCHES "^arm") target_compile_options(${PROJECT_NAME} PRIVATE ${ARCH_SSE2}) endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic -Wextra "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" @@ -76,27 +78,26 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) "-Wno-missing-prototypes" "-Wno-missing-variable-declarations" "-Wno-reserved-id-macro" "-Wno-extra-semi-stmt") elseif(MINGW) - target_compile_definitions(${PROJECT_NAME} PRIVATE $,_DEBUG,NDEBUG>) target_compile_options(${PROJECT_NAME} PRIVATE -Wno-ignored-attributes) target_link_options(${PROJECT_NAME} PRIVATE -municode) -elseif ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) +elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options(${PROJECT_NAME} PRIVATE /sdl /permissive- /Zc:__cplusplus "/wd4061" "/wd4365" "/wd4514" "/wd4571" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) target_compile_options(${PROJECT_NAME} PRIVATE /ZH:SHA_256) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105) endif() - if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) + if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) target_link_options(${PROJECT_NAME} PRIVATE /CETCOMPAT) endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34) target_compile_options(${PROJECT_NAME} PRIVATE /wd5262 /wd5264) endif() endif()