
Add a variable to indicate the latest standard known to be supported for each language: * `CMAKE_C_STANDARD_LATEST` * `CMAKE_CXX_STANDARD_LATEST` * `CMAKE_CUDA_STANDARD_LATEST` * `CMAKE_HIP_STANDARD_LATEST` * `CMAKE_OBJC_STANDARD_LATEST` * `CMAKE_OBJCXX_STANDARD_LATEST` These variables, more generally referred to as `CMAKE_<LANG>_STANDARD_LATEST`, are assigned an integer value which represents the minimum between the latest version of the associated language standard supported by the current compiler and the latest version supported by CMake. Add documentation for these variables in a new page called `CMAKE_<LANG>_STANDARD_LATEST` was added under the "Variables for Languages" section of the `cmake-variables(7)` page. Update each compiler-specific CMake script under `${CMAKE_ROOT}\Modules\Compiler` to manually define the relevant `CMAKE_<LANG>_STANDARD_LATEST` variable as necessary. This will require updating and maintaining as newer compiler versions become recognized by CMake. Closes: #25717
73 lines
2.2 KiB
CMake
73 lines
2.2 KiB
CMake
include(Compiler/TI)
|
|
__compiler_ti(C)
|
|
|
|
# Architecture specific
|
|
# C99 versions: https://processors.wiki.ti.com/index.php/C99_Support_in_TI_Compilers
|
|
|
|
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
|
|
set(__COMPILER_TI_C99_VERSION_ARM 5.2)
|
|
set(__COMPILER_TI_C11_VERSION_ARM 18.12)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
|
|
set(__COMPILER_TI_C99_VERSION_MSP430 4.3)
|
|
set(__COMPILER_TI_C11_VERSION_MSP430 18.12)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
|
|
set(__COMPILER_TI_C99_VERSION_TMS320C28x 6.3)
|
|
set(__COMPILER_TI_C11_VERSION_TMS320C28x 18.9)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
|
|
set(__COMPILER_TI_C99_VERSION_TMS320C6x 7.5)
|
|
|
|
else()
|
|
# architecture not handled
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}")
|
|
|
|
set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi")
|
|
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi")
|
|
|
|
set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi")
|
|
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi")
|
|
|
|
set(CMAKE_C_STANDARD_LATEST 99)
|
|
|
|
if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND
|
|
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}")
|
|
|
|
set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi")
|
|
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi")
|
|
|
|
set(CMAKE_C_STANDARD_LATEST 11)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(CMAKE_C90_STANDARD_COMPILE_OPTION "--strict_ansi")
|
|
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
|
|
set(CMAKE_C_STANDARD_LATEST 90)
|
|
|
|
endif()
|
|
|
|
|
|
# Architecture specific
|
|
|
|
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
|
|
__compiler_check_default_language_standard(C 2.0 90)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430")
|
|
__compiler_check_default_language_standard(C 3.0 90)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x")
|
|
__compiler_check_default_language_standard(C 4.1 90)
|
|
|
|
elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C6x")
|
|
__compiler_check_default_language_standard(C 4.45 90)
|
|
|
|
endif()
|