diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-04-13 15:05:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-18 15:54:33 (GMT) |
commit | eeb58c5c34a888acbb422e66ff7895cb35c9322a (patch) | |
tree | 6cf4d10b2c4fef5ae5064af13d49a36d19956250 /Tests/Module/CheckIPOSupported-Fortran | |
parent | f79b8fad096b08f1fbe8346e1d338cca2c444ccb (diff) | |
download | CMake-eeb58c5c34a888acbb422e66ff7895cb35c9322a.zip CMake-eeb58c5c34a888acbb422e66ff7895cb35c9322a.tar.gz CMake-eeb58c5c34a888acbb422e66ff7895cb35c9322a.tar.bz2 |
Tests: Add cases for typical CheckIPOSupported usage
Diffstat (limited to 'Tests/Module/CheckIPOSupported-Fortran')
-rw-r--r-- | Tests/Module/CheckIPOSupported-Fortran/CMakeLists.txt | 19 | ||||
-rw-r--r-- | Tests/Module/CheckIPOSupported-Fortran/foo.f | 2 | ||||
-rw-r--r-- | Tests/Module/CheckIPOSupported-Fortran/main.f | 3 |
3 files changed, 24 insertions, 0 deletions
diff --git a/Tests/Module/CheckIPOSupported-Fortran/CMakeLists.txt b/Tests/Module/CheckIPOSupported-Fortran/CMakeLists.txt new file mode 100644 index 0000000..dee5c25 --- /dev/null +++ b/Tests/Module/CheckIPOSupported-Fortran/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(CheckIPOSupported-Fortran LANGUAGES Fortran) + +cmake_policy(SET CMP0069 NEW) + +include(CheckIPOSupported) +check_ipo_supported(RESULT ipo_supported) +if(ipo_supported) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +elseif(CMake_TEST_IPO_WORKS_Fortran) + message(FATAL_ERROR "IPO expected to work") +endif() + +add_library(foo foo.f) +add_executable(CheckIPOSupported-Fortran main.f) +target_link_libraries(CheckIPOSupported-Fortran PUBLIC foo) + +enable_testing() +add_test(NAME CheckIPOSupported-Fortran COMMAND CheckIPOSupported-Fortran) diff --git a/Tests/Module/CheckIPOSupported-Fortran/foo.f b/Tests/Module/CheckIPOSupported-Fortran/foo.f new file mode 100644 index 0000000..945d2d5 --- /dev/null +++ b/Tests/Module/CheckIPOSupported-Fortran/foo.f @@ -0,0 +1,2 @@ + SUBROUTINE FOO + END diff --git a/Tests/Module/CheckIPOSupported-Fortran/main.f b/Tests/Module/CheckIPOSupported-Fortran/main.f new file mode 100644 index 0000000..9d1de9f --- /dev/null +++ b/Tests/Module/CheckIPOSupported-Fortran/main.f @@ -0,0 +1,3 @@ + PROGRAM BOO + CALL FOO() + END |