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

William A. Hoffman billlist at nycap.rr.com
Tue Feb 7 18:47:04 EST 2006


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