mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
Merge topic 'xl-fortran-module-dir-use'
92785ed746Tests: Enable Fortran submodule tests on XL compilers210b0b99a9XL: Fix using Fortran modules from their output directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4405
This commit is contained in:
@@ -8,6 +8,7 @@ set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-qfixed") # [=<right_margin>]
|
||||
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-qfree") # [=f90|ibm]
|
||||
|
||||
set(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=")
|
||||
set(CMAKE_Fortran_MODDIR_INCLUDE_FLAG "-I") # -qmoddir= does not affect search path
|
||||
|
||||
set(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
|
||||
|
||||
|
||||
@@ -50,6 +50,15 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
|
||||
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"),
|
||||
mod_dir);
|
||||
this->AppendFlags(flags, modflag);
|
||||
// Some compilers do not search their own module output directory
|
||||
// for using other modules. Add an include directory explicitly
|
||||
// for consistency with compilers that do search it.
|
||||
std::string incflag =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_INCLUDE_FLAG");
|
||||
if (!incflag.empty()) {
|
||||
incflag = cmStrCat(incflag, mod_dir);
|
||||
this->AppendFlags(flags, incflag);
|
||||
}
|
||||
}
|
||||
|
||||
// If there is a separate module path flag then duplicate the
|
||||
|
||||
@@ -21,7 +21,7 @@ end module parent
|
||||
submodule ( parent ) child
|
||||
contains
|
||||
module procedure id
|
||||
f = x
|
||||
id = x
|
||||
end procedure id
|
||||
end submodule child
|
||||
program main
|
||||
|
||||
Reference in New Issue
Block a user