Hello,

I was trying to build my Fortran project with nagfor using the Ninja
generator. I ran into the below error. I am using cmake version 3.9.0.

I found a discussion of a similar error at

http://public.kitware.com/pipermail/cmake/2016-December/064710.html

If I add the following line for the NAG compiler, then the error goes away:

set(CMAKE_Fortran_PREPROCESS_SOURCE
    "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE>
-o <PREPROCESSED_SOURCE>")

I thought I should mention this in case you wanted to add it to CMake.

-Josh


$ cmake ../test -GNinja -DCMAKE_BUILD_TYPE=DEBUG
-DCMAKE_Fortran_COMPILER=nagfor
-- The C compiler identification is GNU 4.5.1
-- The CXX compiler identification is GNU 4.5.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is NAG 6.1.6120
-- Detecting NAG Fortran directory
-- Detecting NAG Fortran directory -
/home/joshua/opt/nag/nagfor_6120/lib/NAG_Fortran
-- Check for working Fortran compiler:
/home/joshua/opt/nag/nagfor_6120/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
/home/joshua/opt/cmake/cmake-3.9.0-Linux-x86_64/share/cmake-3.9/Modules/CMakeTestFortranCompiler.cmake:30
(try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:5 (enable_language)


-- Configuring incomplete, errors occurred!
-- 

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