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

William A. Hoffman billlist at nycap.rr.com
Tue Feb 7 22:55:40 EST 2006


Ok, this seems to be a bug. 

Can you add the following to Modules/CMakeFortranInformation.cmake:

IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
  SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG_INIT}" CACHE STRING
     "Flags used by the compiler during debug builds.")
  SET (CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_MINSIZEREL_INIT}" CACHE STRING
      "Flags used by the compiler during release minsize builds.")
  SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE_INIT}" CACHE STRING
     "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
  SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
     "Flags used by the compiler during Release with Debug Info builds.")

ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)

Also, which generator are you using?  Nmake, or visual studio?

-Bill

At 10:41 PM 2/7/2006, Michael Stephenson wrote:
>I added MESSAGE("hello") as the first line in the Windows-ifort.cmake file. When I configure with CMakeSetup, it displayes the "hello" message twice and then gives the error messages as before.
>
>--Mike
>
>----- Original Message ----- From: "William A. Hoffman" <billlist at nycap.rr.com>
>To: "Michael Stephenson" <mbs at iprovo.net>; <cmake at cmake.org>
>Sent: Tuesday, February 07, 2006 4:47 PM
>Subject: Re: [CMake] CMake C++ and Fortran mixed language project fails
>
>
>>This should work.  Can you add a MESSAGE("hello") into Modules/Platform/Windows-ifort.cmake.
>>Does it show up?  This is the file that sets all of those variables.
>>
>>-Bill
>>
>>
>>
>>At 01:42 PM 2/7/2006, Michael Stephenson wrote:
>>>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: <mailto:billlist at nycap.rr.com>William A. Hoffman
>>>To: <mailto:mbs at iprovo.net>Michael Stephenson ; <mailto:cmake at cmake.org>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
>>>
>>>_______________________________________________
>>>CMake mailing list
>>>CMake at cmake.org
>>>http://www.cmake.org/mailman/listinfo/cmake 



More information about the CMake mailing list