diff options
-rw-r--r-- | Modules/CheckIPOSupported.cmake | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index cca1be9..f0b4fd6 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -91,6 +91,17 @@ macro(_ipo_run_language_check language) set(try_compile_src "${CMAKE_ROOT}/Modules/CheckIPOSupported") + set(_C_ext "c") + set(_CXX_ext "cpp") + set(_Fortran_ext "f") + + set(ext ${_${language}_ext}) + if(NOT "${ext}" STREQUAL "") + set(copy_sources foo.${ext} main.${ext}) + else() + message(FATAL_ERROR "Language not supported") + endif() + # Use: # * TRY_COMPILE_PROJECT_NAME # * CMAKE_VERSION @@ -100,20 +111,6 @@ macro(_ipo_run_language_check language) @ONLY ) - string(COMPARE EQUAL "${language}" "C" is_c) - string(COMPARE EQUAL "${language}" "CXX" is_cxx) - string(COMPARE EQUAL "${language}" "Fortran" is_fortran) - - if(is_c) - set(copy_sources foo.c main.c) - elseif(is_cxx) - set(copy_sources foo.cpp main.cpp) - elseif(is_fortran) - set(copy_sources foo.f main.f) - else() - message(FATAL_ERROR "Language not supported") - endif() - foreach(x ${copy_sources}) configure_file( "${try_compile_src}/${x}" |