diff options
author | Josef Angstenberger <code@jtxa.de> | 2020-09-20 22:42:14 (GMT) |
---|---|---|
committer | Josef Angstenberger <code@jtxa.de> | 2020-09-20 22:57:19 (GMT) |
commit | 8300030f715a872adf2de9ebb1605a37423de5c5 (patch) | |
tree | e6fc176426a0dc2d4726d545a2b24d0089b783b1 | |
parent | 0b4582f229db9fc2b6932c518ab816edd7709406 (diff) | |
download | CMake-8300030f715a872adf2de9ebb1605a37423de5c5.zip CMake-8300030f715a872adf2de9ebb1605a37423de5c5.tar.gz CMake-8300030f715a872adf2de9ebb1605a37423de5c5.tar.bz2 |
Compiler/TI: Check compiler version for C99 support
-rw-r--r-- | Modules/Compiler/TI-C.cmake | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index ec5a509..69cf0a2 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -1,8 +1,39 @@ include(Compiler/TI) __compiler_ti(C) -set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi") -set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi") +# Architecture specific +# C99 versions: https://processors.wiki.ti.com/index.php/C99_Support_in_TI_Compilers -set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi") -set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi") +if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + set(__COMPILER_TI_C99_VERSION_ARM 5.2) + +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") + set(__COMPILER_TI_C99_VERSION_MSP430 4.3) + +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "TMS320C28x") + set(__COMPILER_TI_C99_VERSION_TMS320C28x 6.3) + +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_CXX_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") + +else() + + set(CMAKE_C90_STANDARD_COMPILE_OPTION "--strict_ansi") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--relaxed_ansi") + +endif() |