[CMake] Ninja+Fortran support for PGI compiler (was: Bug in Kitware's release of Ninja when compiling with PGI Fortran)

Brad King brad.king at kitware.com
Thu Dec 15 11:35:31 EST 2016


On 12/13/2016 09:26 PM, Daniel Carrera wrote:
> First of all, I want to say that I think it's amazing that Kitware has
> gone through the trouble of maintaining a separate build of Ninja with
> bugfixes so that us Fortran users can use Ninja with CMake:

Thanks for trying it out!

> -- The Fortran compiler identification is PGI 16.10.0
> -- Check for working Fortran compiler: /usr/local/bin/pgfortran
> CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
> Missing variable is:
> CMAKE_Fortran_PREPROCESS_SOURCE

This is not a problem with Ninja or our branch of it, but rather with
CMake's information about the PGI Fortran compiler not being updated
to support the Ninja generator.  One can see the value for a few other
compilers (from commit 39ebfc79e614dc395d5ace2ad5818b3ba75ca478):

```
$ git grep -A 1 Fortran_PREPROCESS_SOURCE
Modules/Compiler/GNU-Fortran.cmake:set(CMAKE_Fortran_PREPROCESS_SOURCE
Modules/Compiler/GNU-Fortran.cmake-  "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
--
Modules/Compiler/Intel-Fortran.cmake:set(CMAKE_Fortran_PREPROCESS_SOURCE
Modules/Compiler/Intel-Fortran.cmake-  "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
--
Modules/Compiler/SunPro-Fortran.cmake:set(CMAKE_Fortran_PREPROCESS_SOURCE
Modules/Compiler/SunPro-Fortran.cmake-  "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
```

The `Modules/Compiler/PGI-Fortran.cmake` module needs to be updated too.
I don't have that compiler handy, so if you can figure out the appropriate
line to add to that file, please try it out.  If you get it working please
post it and Cc me so it can be integrated.

Thanks,
-Brad



More information about the CMake mailing list