mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-05 14:18:35 -06:00
Features: Make feature recording conditions more consistent
Condition all calls to `_record_compiler_features_{c,cxx}` on
`_result EQUAL 0` so that adding new language standards later does
not need to update them. Avoid some duplicate compiler version
checks by conditioning C11 and CXX14 feature recording on the
existence of `CMAKE_{C11,CXX14}_STANDARD_COMPILE_OPTION` (whose
setting already used the version check).
This commit is contained in:
@@ -27,7 +27,9 @@ endif()
|
|||||||
macro(cmake_record_c_compile_features)
|
macro(cmake_record_c_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
|
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
|
||||||
_record_compiler_features_c(11)
|
if (_result EQUAL 0)
|
||||||
|
_record_compiler_features_c(11)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_c(99)
|
_record_compiler_features_c(99)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ endif()
|
|||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
|
||||||
set(_result 0)
|
if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
|
||||||
if(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
|
|
||||||
_record_compiler_features_cxx(14)
|
_record_compiler_features_cxx(14)
|
||||||
endif()
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ endif()
|
|||||||
macro(cmake_record_c_compile_features)
|
macro(cmake_record_c_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
if (UNIX AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
||||||
_record_compiler_features_c(11)
|
if (_result EQUAL 0)
|
||||||
|
_record_compiler_features_c(11)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_c(99)
|
_record_compiler_features_c(99)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ endif()
|
|||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
||||||
_record_compiler_features_cxx(14)
|
if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
|
||||||
|
_record_compiler_features_cxx(14)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_cxx(11)
|
_record_compiler_features_cxx(11)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ endif()
|
|||||||
|
|
||||||
macro(cmake_record_c_compile_features)
|
macro(cmake_record_c_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
|
||||||
_record_compiler_features_c(11)
|
|
||||||
endif()
|
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
|
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
|
if(_result EQUAL 0 AND CMAKE_C11_STANDARD_COMPILE_OPTION)
|
||||||
|
_record_compiler_features_c(11)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_c(99)
|
_record_compiler_features_c(99)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ endif()
|
|||||||
|
|
||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
|
||||||
_record_compiler_features_cxx(14)
|
|
||||||
endif()
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
|
if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
|
||||||
|
_record_compiler_features_cxx(14)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_cxx(11)
|
_record_compiler_features_cxx(11)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ unset(_ext)
|
|||||||
macro(cmake_record_c_compile_features)
|
macro(cmake_record_c_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
|
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
|
if (_result EQUAL 0 AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
|
||||||
_record_compiler_features_C(11)
|
_record_compiler_features_C(11)
|
||||||
endif()
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
|
|||||||
@@ -66,9 +66,10 @@ unset(_ext)
|
|||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
|
if (_result EQUAL 0 AND
|
||||||
OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
|
(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0
|
||||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0))
|
OR (NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
|
||||||
|
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)))
|
||||||
_record_compiler_features_cxx(14)
|
_record_compiler_features_cxx(14)
|
||||||
endif()
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ endif()
|
|||||||
macro(cmake_record_cxx_compile_features)
|
macro(cmake_record_cxx_compile_features)
|
||||||
set(_result 0)
|
set(_result 0)
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
|
||||||
_record_compiler_features_cxx(11)
|
if (_result EQUAL 0)
|
||||||
|
_record_compiler_features_cxx(11)
|
||||||
|
endif()
|
||||||
if (_result EQUAL 0)
|
if (_result EQUAL 0)
|
||||||
_record_compiler_features_cxx(98)
|
_record_compiler_features_cxx(98)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user