[CMake] Actual effect of set_source_files_properties with COMPILE_FLAGS
pellegrini
pellegrini at ill.fr
Tue Jan 10 04:12:59 EST 2012
Hello everybody,
I work on a Fortran library that for historical reasons should be
maintained with intel fortran compiler, g95 and gfortran
on Linux, Windows and MacOS platoform. Everything everywhere >:o !
My library is made of 50 files. Among those files, most of them will
have to be compiled with a set of flags that
does not match the CMake default ones. But, for a few of them (4
actually) there are some slight variations. For instance,
with g95, 46 files has to compiled with -std=f2003 while the 4 others
ones should have this flag unset.
The strategy I decided to adopt is the following:
- use of a macro to set the standard flags (see attached file
set_compiler_flags.cmake)
- use of set_source_files_properties(${SOURCES} PROPERTIES
COMPILE_FLAGS "-std=f2003")
to set the "-std=f2003" flag for all the files.
- use of set_source_files_properties(file1.f90 PROPERTIES
COMPILE_FLAGS "") to switch off the -std=f2003
flag for the files for which that flag should not be set.
does it look reasonable to you ?
Now my problem. When cmaking my project, I get in one subdirectories of
CMakeFiles a file flags.make that contains the compiler flags. From that
file, it seems that the set_source_files_properties commands were
correctly executed (guessing that the comment for Custom flags is not an
actual comment). But when using nmake in verbose mode, the custom flags
do not appear in the g95 command line. The only ones displayed are the
one set in my set_compiler_flags macro. Is that just a bug on the
display or is there something wrong with my settings ?
thanks a lot
Eric
--
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: set_compiler_flags.cmake
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120110/c3078c0d/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: flags.make
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120110/c3078c0d/attachment.asc>
More information about the CMake
mailing list