diff options
author | Brad King <brad.king@kitware.com> | 2014-05-20 13:40:14 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-05-20 13:40:14 (GMT) |
commit | c1edede31f4e979826a5fc0f6e56b1b59cb00f21 (patch) | |
tree | 11ca8f038a7e363ebd7b218d5cf753fae4b1cd4d /Modules/CMakeDetermineCompileFeatures.cmake | |
parent | 8897116df8e8a6576f2736b96b8e0d529c26139e (diff) | |
parent | e0890d03a48d12904ffe24aa94fb2847d8d5f4e7 (diff) | |
download | CMake-c1edede31f4e979826a5fc0f6e56b1b59cb00f21.zip CMake-c1edede31f4e979826a5fc0f6e56b1b59cb00f21.tar.gz CMake-c1edede31f4e979826a5fc0f6e56b1b59cb00f21.tar.bz2 |
Merge topic 'compile-features-C-language'
e0890d03 Features: Extend concept to C language.
Diffstat (limited to 'Modules/CMakeDetermineCompileFeatures.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompileFeatures.cmake | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index 583ff8d..3762912 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -14,7 +14,45 @@ function(cmake_determine_compile_features lang) - if(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features) + if(lang STREQUAL C AND COMMAND cmake_record_c_compile_features) + message(STATUS "Detecting ${lang} compile features") + + set(CMAKE_C90_COMPILE_FEATURES) + set(CMAKE_C99_COMPILE_FEATURES) + set(CMAKE_C11_COMPILE_FEATURES) + + include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") + + cmake_record_c_compile_features() + + if(NOT _result EQUAL 0) + message(STATUS "Detecting ${lang} compile features - failed") + return() + endif() + + if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES}) + endif() + if (CMAKE_C90_COMPILE_FEATURES AND CMAKE_C99_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_C99_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES}) + endif() + + if(NOT CMAKE_C_COMPILE_FEATURES) + set(CMAKE_C_COMPILE_FEATURES + ${CMAKE_C90_COMPILE_FEATURES} + ${CMAKE_C99_COMPILE_FEATURES} + ${CMAKE_C11_COMPILE_FEATURES} + ) + endif() + + set(CMAKE_C_COMPILE_FEATURES ${CMAKE_C_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE) + + message(STATUS "Detecting ${lang} compile features - done") + + elseif(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features) message(STATUS "Detecting ${lang} compile features") set(CMAKE_CXX98_COMPILE_FEATURES) |