<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 15 December 2016 at 17:35, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
This is not a problem with Ninja or our branch of it, but rather with<br>
CMake's information about the PGI Fortran compiler not being updated<br>
to support the Ninja generator.  One can see the value for a few other<br>
compilers (from commit 39ebfc79e614dc395d5ace2ad5818b<wbr>3ba75ca478):<br>
<br>
```<br>
$ git grep -A 1 Fortran_PREPROCESS_SOURCE<br>
Modules/Compiler/GNU-Fortran.<wbr>cmake:set(CMAKE_Fortran_<wbr>PREPROCESS_SOURCE<br>
Modules/Compiler/GNU-Fortran.<wbr>cmake-  "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")<br>
--<br>
Modules/Compiler/Intel-<wbr>Fortran.cmake:set(CMAKE_<wbr>Fortran_PREPROCESS_SOURCE<br>
Modules/Compiler/Intel-<wbr>Fortran.cmake-  "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")<br>
--<br>
Modules/Compiler/SunPro-<wbr>Fortran.cmake:set(CMAKE_<wbr>Fortran_PREPROCESS_SOURCE<br>
Modules/Compiler/SunPro-<wbr>Fortran.cmake-  "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")<br>
```<br>
<br>
The `Modules/Compiler/PGI-Fortran.<wbr>cmake` module needs to be updated too.<br>
I don't have that compiler handy, so if you can figure out the appropriate<br>
line to add to that file, please try it out.  If you get it working please<br>
post it and Cc me so it can be integrated.<br></blockquote><div><br></div><div><br></div><div>Ok... keeping in mind that I don't know much about CMake or PGI, this seems to be the correct line:</div><div><br></div><div><div>set(CMAKE_Fortran_PREPROCESS_SOURCE</div><div>"<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")</div></div><div><br></div><div><br></div><div>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-<wbr>Fortran.cmake example.</div><div><br></div><div>I added that line to PGI-Fortran.<wbr>cmake and it seems to work. CMake can now make Ninja files for PGI.</div><div><br></div><div>Cheers,</div><div>Daniel.</div></div></div></div>