Ninja does not work with NAG Fortran: Missing variable is: CMAKE_Fortran_PREPROCESS_SOURCE
I recently tried to use cmake -G Ninja
with NAG Fortran and:
❯ cmake .. -G Ninja
-- The Fortran compiler identification is NAG 7.0.7020
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting NAG Fortran directory
-- Detecting NAG Fortran directory - /Users/mathomp4/installed/Core/nag/7.0_7020/lib/NAG_Fortran
-- Check for working Fortran compiler: /Users/mathomp4/installed/Core/nag/7.0_7020/bin/nagfor
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_Fortran_PREPROCESS_SOURCE
CMake Error at /Users/mathomp4/.homebrew/brew/Cellar/cmake/3.18.4/share/cmake/Modules/CMakeTestFortranCompiler.cmake:39 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
CMakeLists.txt:27 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/mathomp4/IntelTimingTest/pFUnit/build-nag-Ninja/CMakeFiles/CMakeOutput.log".
See also "/Users/mathomp4/IntelTimingTest/pFUnit/build-nag-Ninja/CMakeFiles/CMakeError.log".
So, I'm assuming this is similar to #19450 (closed)
I'm willing to try and figure out a CMAKE_Fortran_PREPROCESS_SOURCE
for NAG Fortran, but there is a "hitch": NAG Fortran doesn't have a way to spit out the source to standard output, i.e., the usual -E
, that I can see (I might ask their support). It does have:
-F Preprocess only, do not compile. Each file that is preprocessed will produce an output file of the same name with the suffix replaced by .f, .f90 or .f95 according to the suffix of the input file. This option is equivalent to -otype=Fortran.
I'm wondering: is there an example in the CMake source for a Fortran compiler that doesn't have the -E
functionality that might get Ninja working with NAG?