mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 14:20:06 -06:00
Fortran: Add support for [CMAKE_]Fortran_LINKER_LAUNCHER
`CMAKE_<LANG>_LINKER_LAUNCHER` and `<LANG>_LINKER_LAUNCHER` are already support for C, CXX, OBJC, and OBJCXX. Add Fortran. Closes: #26951
This commit is contained in:
committed by
Brad King
parent
38bcc1d014
commit
d176a8c5ce
@@ -3,8 +3,15 @@
|
|||||||
|
|
||||||
.. versionadded:: 3.21
|
.. versionadded:: 3.21
|
||||||
|
|
||||||
This property is implemented only when ``<LANG>`` is ``C``, ``CXX``,
|
This property is implemented only when ``<LANG>`` is one of:
|
||||||
``OBJC``, or ``OBJCXX``
|
|
||||||
|
* ``C``
|
||||||
|
* ``CXX``
|
||||||
|
* ``OBJC``
|
||||||
|
* ``OBJCXX``
|
||||||
|
* ``Fortran``
|
||||||
|
|
||||||
|
.. versionadded:: 4.1
|
||||||
|
|
||||||
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a
|
Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a
|
||||||
command line for a linker launching tool. The :ref:`Makefile Generators` and the
|
command line for a linker launching tool. The :ref:`Makefile Generators` and the
|
||||||
|
|||||||
7
Help/release/dev/linker-launcher.rst
Normal file
7
Help/release/dev/linker-launcher.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
linker-launcher
|
||||||
|
---------------
|
||||||
|
|
||||||
|
* :ref:`Makefile Generators` and :ref:`Ninja Generators` gained support
|
||||||
|
for adding a linker launcher with ``Fortran``.
|
||||||
|
See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
|
||||||
|
and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
|
||||||
@@ -5,7 +5,15 @@ CMAKE_<LANG>_LINKER_LAUNCHER
|
|||||||
|
|
||||||
Default value for :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property. This
|
Default value for :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property. This
|
||||||
variable is used to initialize the property on each target as it is created.
|
variable is used to initialize the property on each target as it is created.
|
||||||
This is done only when ``<LANG>`` is ``C``, ``CXX``, ``OBJC``, or ``OBJCXX``.
|
This is done only when ``<LANG>`` is one of:
|
||||||
|
|
||||||
|
* ``C``
|
||||||
|
* ``CXX``
|
||||||
|
* ``OBJC``
|
||||||
|
* ``OBJCXX``
|
||||||
|
* ``Fortran``
|
||||||
|
|
||||||
|
.. versionadded:: 4.1
|
||||||
|
|
||||||
This variable is initialized to the :envvar:`CMAKE_<LANG>_LINKER_LAUNCHER`
|
This variable is initialized to the :envvar:`CMAKE_<LANG>_LINKER_LAUNCHER`
|
||||||
environment variable if it is set.
|
environment variable if it is set.
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ if(NOT CMAKE_Fortran_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_Fortran_COMPILER_LA
|
|||||||
CACHE STRING "Compiler launcher for Fortran.")
|
CACHE STRING "Compiler launcher for Fortran.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_Fortran_LINKER_LAUNCHER AND DEFINED ENV{CMAKE_Fortran_LINKER_LAUNCHER})
|
||||||
|
set(CMAKE_Fortran_LINKER_LAUNCHER "$ENV{CMAKE_Fortran_LINKER_LAUNCHER}"
|
||||||
|
CACHE STRING "Linker launcher for Fortran.")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CMakeCommonLanguageInclude)
|
include(CMakeCommonLanguageInclude)
|
||||||
_cmake_common_language_platform_flags(Fortran)
|
_cmake_common_language_platform_flags(Fortran)
|
||||||
|
|
||||||
|
|||||||
@@ -457,6 +457,8 @@ TargetProperty const StaticTargetProperties[] = {
|
|||||||
{ "OBJC_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
{ "OBJC_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||||
// ---- Objective C++
|
// ---- Objective C++
|
||||||
{ "OBJCXX_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
{ "OBJCXX_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||||
|
// ---- Fortran
|
||||||
|
{ "Fortran_LINKER_LAUNCHER"_s, IC::CanCompileSources },
|
||||||
|
|
||||||
// Static analysis
|
// Static analysis
|
||||||
// -- C
|
// -- C
|
||||||
|
|||||||
1
Tests/RunCMake/LinkerLauncher/Fortran-Build-stdout.txt
Normal file
1
Tests/RunCMake/LinkerLauncher/Fortran-Build-stdout.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.*-E env USED_LAUNCHER=1.*
|
||||||
3
Tests/RunCMake/LinkerLauncher/Fortran-common.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/Fortran-common.cmake
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
enable_language(Fortran)
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||||
|
add_executable(main main.f90)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=Fortran.*
|
||||||
1
Tests/RunCMake/LinkerLauncher/Fortran-env.cmake
Normal file
1
Tests/RunCMake/LinkerLauncher/Fortran-env.cmake
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include(Fortran-common.cmake)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.*-E env USED_LAUNCHER=1.*
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.*-E env USED_LAUNCHER=1 TARGET_NAME=main LANGUAGE=Fortran.*
|
||||||
3
Tests/RunCMake/LinkerLauncher/Fortran-launch-env.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/Fortran-launch-env.cmake
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set(CTEST_USE_LAUNCHERS 1)
|
||||||
|
include(CTestUseLaunchers)
|
||||||
|
include(Fortran-env.cmake)
|
||||||
3
Tests/RunCMake/LinkerLauncher/Fortran-launch.cmake
Normal file
3
Tests/RunCMake/LinkerLauncher/Fortran-launch.cmake
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set(CTEST_USE_LAUNCHERS 1)
|
||||||
|
include(CTestUseLaunchers)
|
||||||
|
include(Fortran.cmake)
|
||||||
2
Tests/RunCMake/LinkerLauncher/Fortran.cmake
Normal file
2
Tests/RunCMake/LinkerLauncher/Fortran.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
set(CMAKE_Fortran_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
|
||||||
|
include(Fortran-common.cmake)
|
||||||
@@ -24,6 +24,9 @@ function(run_linker_launcher_env lang)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(langs C CXX)
|
set(langs C CXX)
|
||||||
|
if(CMake_TEST_Fortran)
|
||||||
|
list(APPEND langs Fortran)
|
||||||
|
endif()
|
||||||
if(CMake_TEST_OBJC)
|
if(CMake_TEST_OBJC)
|
||||||
list(APPEND langs OBJC OBJCXX)
|
list(APPEND langs OBJC OBJCXX)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
4
Tests/RunCMake/LinkerLauncher/main.f90
Normal file
4
Tests/RunCMake/LinkerLauncher/main.f90
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
program main
|
||||||
|
implicit none
|
||||||
|
! Do nothing
|
||||||
|
end program main
|
||||||
Reference in New Issue
Block a user