[CMake] CMake C++ and Fortran mixed language project fails

Michael Stephenson mbs at iprovo.net
Tue Feb 7 13:42:54 EST 2006


I do have Fortran enabled. Here is a much simplified CMakeLists.txt that has this problem. Again, everything works on Linux/Unix, but I get errors when using CMakeSetup on Windows.

PROJECT(test_fort CXX Fortran)

# C++ files
SET(CXX_TEST_SRCS test1.cpp)

# Fortran files
SET(FORT_TEST_SRCS test2.f test3.f test4.f)

ADD_DEFINITIONS(-DTEST_FORT)

ADD_LIBRARY(test_fort ${CXX_TEST_SRCS} ${FORT_TEST_SRCS})

SET_TARGET_PROPERTIES(test_fort PROPERTIES LINKER_LANGUAGE CXX)

--Mike

  ----- Original Message ----- 
  From: William A. Hoffman 
  To: Michael Stephenson ; cmake at cmake.org 
  Sent: Monday, February 06, 2006 2:32 PM
  Subject: Re: [CMake] CMake C++ and Fortran mixed language project fails


  At 10:18 PM 2/2/2006, Michael Stephenson wrote:

    I have a mixed language C++ and Fortran project that works on Linux. I'm now trying to run it on Windows. CMakeSetup generates the following errors:
     
    CMakeError: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_Fortran_FLAGS_RELEASE
     
    This message is repeated for CMAKE_Fortran_FLAGS_MINSIZEREL, CMAKE_Fortran_FLAGS_DEBUG, and CMAKE_Fortran_FLAGS_RELWITHDEBINFO.
     
    I then get this error message:
     
    CMakeError: Internal CMake error, TryCompile generation of cmake failed.
     
    and finally:
     
    The Fortran compiler "ifort.exe" is not able to compile a simple test program.
    It fails with the following output:
    (blank)
     
    CMake will not be able to correctly generate this project.
     
    Since CMake is able to find the Fortran compiler, why doesn't it set the *Release, etc. flags and compile the test program.
     
    --Mike Stephenson
     
  You should enable Fortran like this:
  PROJECT(testf Fortran)
  There is a test in CMake/Tests/Fortran.

  -Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060207/33d83682/attachment.html


More information about the CMake mailing list