mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-30 18:29:37 -06:00
CheckIPOSupported: Add Fortran support
This commit is contained in:
committed by
Brad King
parent
c92fd25661
commit
87199ea66b
@@ -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()
|
||||
|
||||
8
Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in
Normal file
8
Modules/CheckIPOSupported/CMakeLists-Fortran.txt.in
Normal file
@@ -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)
|
||||
2
Modules/CheckIPOSupported/foo.f
Normal file
2
Modules/CheckIPOSupported/foo.f
Normal file
@@ -0,0 +1,2 @@
|
||||
SUBROUTINE FOO
|
||||
END
|
||||
3
Modules/CheckIPOSupported/main.f
Normal file
3
Modules/CheckIPOSupported/main.f
Normal file
@@ -0,0 +1,3 @@
|
||||
PROGRAM BOO
|
||||
CALL FOO()
|
||||
END
|
||||
@@ -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)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -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\)$
|
||||
@@ -1 +0,0 @@
|
||||
check_ipo_supported(LANGUAGES "Fortran")
|
||||
Reference in New Issue
Block a user