diff options
author | Brad King <brad.king@kitware.com> | 2017-04-05 14:15:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-04-05 14:16:00 (GMT) |
commit | 6e9dc960c56b0baaf7599d21bb09d1a7e653d4f7 (patch) | |
tree | 03fe44309fe602a34748e94c6e6e8230de516fc6 | |
parent | 820af5f7974734e78db9896b4f182d667a491c4f (diff) | |
parent | 87199ea66b171708736e85989bf9b0af89a805c1 (diff) | |
download | CMake-6e9dc960c56b0baaf7599d21bb09d1a7e653d4f7.zip CMake-6e9dc960c56b0baaf7599d21bb09d1a7e653d4f7.tar.gz CMake-6e9dc960c56b0baaf7599d21bb09d1a7e653d4f7.tar.bz2 |
Merge topic 'CheckIPOSupported-Fortran'
87199ea6 CheckIPOSupported: Add Fortran support
c92fd256 CheckIPOSupported: Move '_CMakeLTOTest-*' under 'CMakeFiles'
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !655
-rw-r--r-- | Modules/CheckIPOSupported.cmake | 11 | ||||
-rw-r--r-- | Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in | 8 | ||||
-rw-r--r-- | Modules/CheckIPOSupported/foo.f | 2 | ||||
-rw-r--r-- | Modules/CheckIPOSupported/main.f | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake | 1 |
8 files changed, 17 insertions, 16 deletions
diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake index 31c1bd3..712a95e 100644 --- a/Modules/CheckIPOSupported.cmake +++ b/Modules/CheckIPOSupported.cmake @@ -67,7 +67,7 @@ endmacro() # Run IPO/LTO test macro(_ipo_run_language_check language) - set(testdir "${CMAKE_CURRENT_BINARY_DIR}/_CMakeLTOTest-${language}") + set(testdir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/_CMakeLTOTest-${language}") file(REMOVE_RECURSE "${testdir}") file(MAKE_DIRECTORY "${testdir}") @@ -93,11 +93,14 @@ macro(_ipo_run_language_check language) 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() @@ -204,12 +207,6 @@ function(check_ipo_supported) endif() endif() - list(FIND languages "Fortran" result) - if(NOT result EQUAL -1) - _ipo_not_supported("Fortran is not supported") - return() - endif() - if(NOT _CMAKE_IPO_SUPPORTED_BY_CMAKE) _ipo_not_supported("CMake doesn't support IPO for current compiler") return() diff --git a/Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in b/Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in new file mode 100644 index 0000000..9fab077 --- /dev/null +++ b/Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION "@CMAKE_VERSION@") +project("@TRY_COMPILE_PROJECT_NAME@" LANGUAGES Fortran) + +cmake_policy(SET CMP0069 NEW) + +add_library(foo foo.f) +add_executable(boo main.f) +target_link_libraries(boo PUBLIC foo) diff --git a/Modules/CheckIPOSupported/foo.f b/Modules/CheckIPOSupported/foo.f new file mode 100644 index 0000000..945d2d5 --- /dev/null +++ b/Modules/CheckIPOSupported/foo.f @@ -0,0 +1,2 @@ + SUBROUTINE FOO + END diff --git a/Modules/CheckIPOSupported/main.f b/Modules/CheckIPOSupported/main.f new file mode 100644 index 0000000..9d1de9f --- /dev/null +++ b/Modules/CheckIPOSupported/main.f @@ -0,0 +1,3 @@ + PROGRAM BOO + CALL FOO() + END diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake index 812f79b..588a75d 100644 --- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake @@ -2,7 +2,6 @@ include(RunCMake) run_cmake(unparsed-arguments) run_cmake(user-lang-unknown) -run_cmake(user-lang-fortran) run_cmake(default-lang-none) run_cmake(not-supported-by-cmake) run_cmake(not-supported-by-compiler) diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt deleted file mode 100644 index 2cb595d..0000000 --- a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Error at .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(message\): - IPO is not supported \(Fortran is not supported\)\. -Call Stack \(most recent call first\): - .*/Modules/CheckIPOSupported\.cmake:[0-9]+ \(_ipo_not_supported\) - user-lang-fortran\.cmake:[0-9]+ \(check_ipo_supported\) - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake b/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake deleted file mode 100644 index 275dbd9..0000000 --- a/Tests/RunCMake/CheckIPOSupported/user-lang-fortran.cmake +++ /dev/null @@ -1 +0,0 @@ -check_ipo_supported(LANGUAGES "Fortran") |