[CMake] Three problems with cmake under windows

lucatrv lucatrv at hotmail.com
Tue Jun 5 12:13:31 EDT 2007


Hi, first of all, sorry for my late reply.

>> 1) the default intel fortran installation set two environment variables 
>> FFLAGS and F90FLAGS, with the following value:
>> /w /I:"C:\Programmi\VNI\CTT6.0\include\IA32" /fpe:3 /nologo.
>> I found that cmake have problems when it tests if the ifort compiler 
>> works. It seems to be a problem in the path format. In fact, a possible 
>> solution is to remove the /I:"C:\Programmi\VNI\CTT6.0\include\IA32" part 
>> from the variable. Otherwise it is possible to use se folowing cmake 
>> command:
>> FILE(TO_CMAKE_PATH $ENV{F90FLAGS} CMAKE_Fortran_FLAGS)
>> However, in this case, the first time §I call cmake it still fails, while 
>> the following times it works.
> CMake does look at FFLAGS like it looks at CFLAGS.   What is the error 
> that you get with the values set?

I copy here the error message:

-- Check for working Fortran compiler: 
C:/Programmi/Intel/Compiler/Fortran/9.1/I
A32/Bin/ifort.exe
CMake Error: Invalid escape sequence \P
Syntax error in cmake code at
c:/z3/cmake/CMakeFiles/CMakeTmp/CMakeLists.txt:3:
syntax error, unexpected cal_ERROR, expecting $end (4), when parsing string 
"C:\
Programmi\VNI\CTT6.0\include\IA32" /W1  ${COMPILE_DEFINITIONS}""
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working Fortran compiler: 
C:/Programmi/Intel/Compiler/Fortran/9.1/I
A32/Bin/ifort.exe -- broken
CMake Error: The Fortran compiler 
"C:/Programmi/Intel/Compiler/Fortran/9.1/IA32/
Bin/ifort.exe" is not able to compile a simple test program.
It fails with the following output:

CMake will not be able to correctly generate this project.
-- Configuring done


I think that cmake has problems because the path is written in windows 
format (with \). However, that one in the default FFLAGS value when you 
install ifort on windows.


>> 2) Since I have two fortran compilers installed, sometimes I chose to use 
>> gfortran and sometimes ifort.
>> However, If I use the following commands in this order:
>> PROJECT (hello Fortran)
>> SET (CMAKE_Fortran_COMPILER gfortran)
>> cmake still tests ifort working when creating the makefile.
>> The only whay to have cmake make use only of gfortran is to use the 
>> commands in the following order:
>> SET (CMAKE_Fortran_COMPILER gfortran)
>> PROJECT (hello Fortran)
>> I think it would be better that cmake set the right compiler also in the 
>> first case, also because the required order is not specified in the cmake 
>> documentation.
>>
> You can not set the compiler like that.   You have to set the environment 
> variable FC before you run cmake.  There has been a request to add a way 
> to do this from CMakeSetup, but it has not yet been implemented.

Ok, thank you. Anyway, can you tell me where I can find a list of 
environment variables used by cmake so that I know which ones have an effect 
on the configuration of the project?

>> 3) When I build my project with ifort (which makes use of the microsoft 
>> linker) at the EXECUTABLE_OUTPUT_PATH, i get a hello.ilk file together 
>> with the hello.exe file (the ilk file is a Microsoft Linker Database).
> That is the default behavior of CMake with c/C++.   We do not separate the 
> linker database from the executable.   You may want to look at the install 
> commands and cpack if you want to create executables that are moved to a 
> different machine, and only contain the stuff you need to run them.

Thank you again for the hint.

Luca 



More information about the CMake mailing list