CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2018-02-20T16:28:55-05:00https://gitlab.kitware.com/cmake/cmake/-/issues/16332ninja generator fortran support: original source file directory is not search...2018-02-20T16:28:55-05:00Keith Millerninja generator fortran support: original source file directory is not searched when using fortran INCLUDE statementWhen a file is INCLUDEed in fortran, the original source directory that contains the source file with the INCLUDE statement should be searched for the included file ahead of any directories that are specified with -I. It would normally ...When a file is INCLUDEed in fortran, the original source directory that contains the source file with the INCLUDE statement should be searched for the included file ahead of any directories that are specified with -I. It would normally be functionality that is implicitly provided by the compiler, but since the pre-processed file is located out-of-tree, the original source directory may need to be added to the include path?
Please find attached test case:
[ftest.tar.xz](/uploads/ef25355d9e5bc684b7d335fe27527112/ftest.tar.xz)3.7.0Nils GladitzNils Gladitzhttps://gitlab.kitware.com/cmake/cmake/-/issues/16265Missing @CMAKE_Fortran_SYSROOT_FLAG_CODE@ within CMakeFortranCompiler.cmake.in2018-02-20T16:28:55-05:00Ghost UserMissing @CMAKE_Fortran_SYSROOT_FLAG_CODE@ within CMakeFortranCompiler.cmake.inHi All,
while calling 'cmake ./' in a build box the following messages...
```
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler support...Hi All,
while calling 'cmake ./' in a build box the following messages...
```
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
```
...are printed because of two missing statements ...
```cmake
@CMAKE_Fortran_SYSROOT_FLAG_CODE@
@CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
```
... in CMakeFortranCompiler.cmake.in (similar to CMakeCCompiler.cmake.in)
Could someone please add them?
Thanks in advance.3.7.0Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/16236Bad option -fPIE for NAG Fortran2018-02-20T16:28:56-05:00Neil Carlsonneil.n.carlson@gmail.comBad option -fPIE for NAG FortranWith set(CMAKE_POSITION_INDEPENDENT_CODE True) the flag -fPIE is being passed to the NAG Fortran compiler for source files that get linked into an executable. The compiler doesn't recognize this flag and exits with an error.
The NAG...With set(CMAKE_POSITION_INDEPENDENT_CODE True) the flag -fPIE is being passed to the NAG Fortran compiler for source files that get linked into an executable. The compiler doesn't recognize this flag and exits with an error.
The NAG compiler doesn't have any notion of "PIE". its flag for PIC is -PIC. If that is an adequate substitute (I don't understand what the practical difference is), then adding
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
to the bottom of NAG-Fortran.cmake appears to work fine. Alternatively, because the compiler actually generates C code that it then compiles using the underlying system C compiler, it is possible on Linux, where it uses gcc, to use -fPIE by instead adding
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-Wc,-fPIE")
But this will probably not be the same on other platforms that the NAG compiler is available for, so probably not a good choice.3.7.0Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/16234CMake supporting for Fortran 2008 submodules2018-02-20T16:28:55-05:00Damian RousonCMake supporting for Fortran 2008 submodulesThe transcript below and the attached file [fortran-submodule-support.tar.gz](/uploads/8795713101815402faae472a92c880f9/fortran-submodule-support.tar.gz) demonstrate a skeleton Fortran 2008 submodule implementation that is currently supp...The transcript below and the attached file [fortran-submodule-support.tar.gz](/uploads/8795713101815402faae472a92c880f9/fortran-submodule-support.tar.gz) demonstrate a skeleton Fortran 2008 submodule implementation that is currently supported by the GNU, Cray, IBM, and Intel compilers. As discussed on the [CMake users list in March 2016](https://cmake.org/pipermail/cmake/2016-March/063056.html), the CMake parser apparently cannot handle this syntax.
```console
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
project (fortran-submodule-issue Fortran)
add_executable(submodule-issue-reproducer fortran-submodule.F90)
rouson@localhost:~/Code/AdHoc/src/cmake/bug-xxxxy$ cat fortran-submodule.f90
module foo_interface
implicit none
interface
module subroutine foo()
end subroutine
end interface
end module
submodule (foo_interface) foo_implementation
implicit none
contains
module subroutine foo()
end subroutine
end submodule
end ! Dummy main program to produce an executable file
$ mkdir build
$ cd build
$ FC=gfortran cmake ..
-- The Fortran compiler identification is GNU 6.1.0
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Check for working Fortran compiler: /opt/local/bin/gfortran
-- Check for working Fortran compiler: /opt/local/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /opt/local/bin/gfortran supports Fortran 90
-- Checking whether /opt/local/bin/gfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rouson/Code/AdHoc/src/cmake/bug-xxxxy/build
rouson@localhost:~/Code/AdHoc/src/cmake/bug-xxxxy/build$ make
Scanning dependencies of target submodule-issue-reproducer
[ 50%] Building Fortran object CMakeFiles/submodule-issue-reproducer.dir/fortran-submodule.F90.o
Error copying Fortran module "subroutine". Tried "SUBROUTINE.mod" and "subroutine.mod".
make[2]: *** [CMakeFiles/submodule-issue-reproducer.dir/fortran-submodule.F90.o.provides.build] Error 1
make[1]: *** [CMakeFiles/submodule-issue-reproducer.dir/all] Error 2
make: *** [all] Error 2
$ gfortran --version
GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0
$ cmake --version
cmake version 3.6.1
```
3.7.0Brad KingBrad King