On 15 December 2016 at 17:35, Brad King <[email protected]> wrote:

>
> 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.
>


Ok... keeping in mind that I don't know much about CMake or PGI, this seems
to be the correct line:

set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E
<SOURCE> > <PREPROCESSED_SOURCE>")


The PGI documentation says that -Mpreprocess "instructs the compiler to
perform cpp-like preprocessing on assembly and Fortran input source files".
The -E flag causes the compiler to spit the result to stdout instead of
saving it to a file. Since the -E flag behaves as in the Intel compiler, I
used copied the stdout redirect ">" from the Intel-Fortran.cmake example.

I added that line to PGI-Fortran.cmake and it seems to work. CMake can now
make Ninja files for PGI.

Cheers,
Daniel.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to