Merge topic 'fix-forced-toolchain-dialect'

441dba80 Project: Guess default standard dialect if compiler was forced (#15852)
This commit is contained in:
Brad King 2015-11-20 08:53:05 -05:00 committed by CMake Topic Stage
commit 1ccb417d61
7 changed files with 29 additions and 0 deletions

View File

@ -18,6 +18,9 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
endif()
set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_C_STANDARD_DEFAULT 99)
endif()
endif()

View File

@ -28,6 +28,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_CXX_STANDARD_DEFAULT 98)
endif()
endif()

View File

@ -23,6 +23,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
endif()
set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6)
set(CMAKE_C_STANDARD_DEFAULT 11)
else()
set(CMAKE_C_STANDARD_DEFAULT 99)
endif()
endif()
endif()

View File

@ -37,6 +37,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_CXX_STANDARD_DEFAULT 98)
endif()
endif()

View File

@ -28,6 +28,13 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4)
message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}")
endif()
set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set(CMAKE_C_STANDARD_DEFAULT 11)
else()
set(CMAKE_C_STANDARD_DEFAULT 90)
endif()
endif()
endif()

View File

@ -40,6 +40,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_CXX_STANDARD_DEFAULT 98)
endif()
endif()

View File

@ -42,6 +42,9 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
endif()
set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
elseif(NOT DEFINED CMAKE_CXX_STANDARD_DEFAULT)
# Compiler id was forced so just guess the default standard level.
set(CMAKE_CXX_STANDARD_DEFAULT 98)
endif()
endif()