CMakeDetermineCompileFeatures.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #=============================================================================
  2. # Copyright 2013 Stephen Kelly <[email protected]>
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. function(cmake_determine_compile_features lang)
  14. if(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features)
  15. message(STATUS "Detecting ${lang} compile features")
  16. set(CMAKE_CXX11_COMPILE_FEATURES)
  17. include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
  18. cmake_record_cxx_compile_features()
  19. if(NOT _result EQUAL 0)
  20. message(STATUS "Detecting ${lang} compile features - failed")
  21. return()
  22. endif()
  23. if(NOT CMAKE_CXX_COMPILE_FEATURES)
  24. set(CMAKE_CXX_COMPILE_FEATURES
  25. ${CMAKE_CXX11_COMPILE_FEATURES}
  26. )
  27. endif()
  28. set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
  29. set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
  30. message(STATUS "Detecting ${lang} compile features - done")
  31. endif()
  32. endfunction()