mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 03:29:18 -05:00
Merge topic 'CheckIPOSupported-Fortran'
87199ea6CheckIPOSupported: Add Fortran supportc92fd256CheckIPOSupported: Move '_CMakeLTOTest-*' under 'CMakeFiles' Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !655
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,2 @@
|
||||
SUBROUTINE FOO
|
||||
END
|
||||
@@ -0,0 +1,3 @@
|
||||
PROGRAM BOO
|
||||
CALL FOO()
|
||||
END
|
||||
Reference in New Issue
Block a user