[CMake] question about SET_SOURCE_FILES_PROPERTIES

pellegrini pellegrini at ill.fr
Thu Dec 12 03:42:15 EST 2013


Dear CMakers,

I have a Fortran project to be built on Windows and Linux using ifort 
compiler. For two of the project files, I need to add
specific compiler flag (i.e. /assume:byterecl). To do so, I used the 
following CMake command:

SET_SOURCE_FILES_PROPERTIES(file1.f90 PROPERTIES COMPILE_FLAGS 
"${CMAKE_Fortran_FLAGS} /assume:byterecl")

There is one point I could not make clear up to now: if I want this 
extra flag to be used whatever the
CMAKE_BUILD_TYPE, is the above command sufficient ? By sufficient I mean 
will the use of
${CMAKE_Fortran_FLAGS} be spread all over the 
${CMAKE_Fortran_FLAGS_DEBUG}, ${CMAKE_Fortran_FLAGS_RELEASE} ... flags ?

I would like to avoid something like:

IF(CMAKE_BUILD_TYPE STREQUAL Debug)
     SET_SOURCE_FILES_PROPERTIES(file1.f90 PROPERTIES COMPILE_FLAGS 
"${CMAKE_Fortran_FLAGS_DEBUG} /assume:byterecl")
ELSEIF(CMAKE_BUILD_TYPE STREQUAL Release)
     SET_SOURCE_FILES_PROPERTIES(file1.f90 PROPERTIES COMPILE_FLAGS 
"${CMAKE_Fortran_FLAGS_RELEASE} /assume:byterecl")

... and so on for the other build type. Not very nice isn't it but do I 
have the choice ?

thanks a lot for your help

Eric



More information about the CMake mailing list