CMake code review (#166)
This commit is contained in:
Родитель
d369c64c9b
Коммит
2c7f6d8155
|
@ -311,7 +311,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
set(WarningsEXE "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4711" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd4061" "/wd4062" "/wd5219")
|
||||
set(WarningsEXE "/wd4365" "/wd4514" "/wd4571" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4711" "/wd4751" "/wd4774" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd4061" "/wd4062" "/wd5219")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.34)
|
||||
list(APPEND WarningsEXE "/wd5262" "/wd5264")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE "/wd5262")
|
||||
|
|
|
@ -85,18 +85,40 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
|
|||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
list(APPEND COMPILER_SWITCHES /Zc:__cplusplus /Zc:inline /fp:fast /Qdiag-disable:161)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
list(APPEND COMPILER_SWITCHES /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline /fp:fast)
|
||||
list(APPEND COMPILER_SWITCHES /sdl /Zc:inline /fp:fast)
|
||||
|
||||
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
message(STATUS "Building using Whole Program Optimization")
|
||||
list(APPEND COMPILER_SWITCHES $<$<NOT:$<CONFIG:Debug>>:/Gy /Gw>)
|
||||
endif()
|
||||
|
||||
if(OpenMP_CXX_FOUND)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10)
|
||||
list(APPEND COMPILER_SWITCHES /permissive-)
|
||||
endif()
|
||||
|
||||
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11)
|
||||
AND (OpenMP_CXX_FOUND
|
||||
OR (XBOX_CONSOLE_TARGET STREQUAL "durango")))
|
||||
# OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup
|
||||
list(APPEND COMPILER_SWITCHES /Zc:twoPhase-)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.14)
|
||||
list(APPEND COMPILER_SWITCHES /Zc:__cplusplus)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.15)
|
||||
list(APPEND COMPILER_SWITCHES /JMC-)
|
||||
endif()
|
||||
|
||||
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.20)
|
||||
AND (XBOX_CONSOLE_TARGET STREQUAL "durango"))
|
||||
list(APPEND COMPILER_SWITCHES /d2FH4-)
|
||||
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
list(APPEND LINKER_SWITCHES -d2:-FH4-)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
|
||||
list(APPEND COMPILER_SWITCHES /ZH:SHA_256)
|
||||
endif()
|
||||
|
@ -114,6 +136,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|||
list(APPEND COMPILER_SWITCHES /Zc:lambda)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29)
|
||||
list(APPEND COMPILER_SWITCHES /external:W4)
|
||||
endif()
|
||||
|
||||
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31)
|
||||
AND (XBOX_CONSOLE_TARGET STREQUAL "durango"))
|
||||
list(APPEND COMPILER_SWITCHES /Zc:static_assert-)
|
||||
|
|
Загрузка…
Ссылка в новой задаче