2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
2013-10-17 13:47:29 +04:00
|
|
|
|
|
|
|
|
|
|
|
function(cmake_determine_compile_features lang)
|
|
|
|
|
2013-11-04 04:15:43 +04:00
|
|
|
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)
|
2013-10-17 13:47:29 +04:00
|
|
|
message(STATUS "Detecting ${lang} compile features")
|
|
|
|
|
2014-04-06 13:40:11 +04:00
|
|
|
set(CMAKE_CXX98_COMPILE_FEATURES)
|
2013-10-17 13:47:29 +04:00
|
|
|
set(CMAKE_CXX11_COMPILE_FEATURES)
|
2014-05-06 02:21:14 +04:00
|
|
|
set(CMAKE_CXX14_COMPILE_FEATURES)
|
2013-10-17 13:47:29 +04:00
|
|
|
|
|
|
|
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
|
|
|
|
|
|
|
|
cmake_record_cxx_compile_features()
|
|
|
|
|
|
|
|
if(NOT _result EQUAL 0)
|
|
|
|
message(STATUS "Detecting ${lang} compile features - failed")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2014-05-06 02:21:14 +04:00
|
|
|
if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES)
|
|
|
|
list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES})
|
|
|
|
endif()
|
|
|
|
if (CMAKE_CXX98_COMPILE_FEATURES AND CMAKE_CXX11_COMPILE_FEATURES)
|
2014-04-06 13:40:11 +04:00
|
|
|
list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES})
|
|
|
|
endif()
|
|
|
|
|
2013-10-17 13:47:29 +04:00
|
|
|
if(NOT CMAKE_CXX_COMPILE_FEATURES)
|
|
|
|
set(CMAKE_CXX_COMPILE_FEATURES
|
2014-04-06 13:40:11 +04:00
|
|
|
${CMAKE_CXX98_COMPILE_FEATURES}
|
2013-10-17 13:47:29 +04:00
|
|
|
${CMAKE_CXX11_COMPILE_FEATURES}
|
2014-05-06 02:21:14 +04:00
|
|
|
${CMAKE_CXX14_COMPILE_FEATURES}
|
2013-10-17 13:47:29 +04:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
|
2014-04-06 13:40:11 +04:00
|
|
|
set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
|
2013-10-17 13:47:29 +04:00
|
|
|
set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
|
2014-05-06 02:21:14 +04:00
|
|
|
set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
|
2013-10-17 13:47:29 +04:00
|
|
|
|
|
|
|
message(STATUS "Detecting ${lang} compile features - done")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endfunction()
|