[CMake] Actual effect of set_source_files_properties with COMPILE_FLAGS - solved

pellegrini pellegrini at ill.fr
Wed Jan 11 03:15:50 EST 2012


Hello everybody,

that's finally OK. Indeed; everything was OK. I did not pay attention 
that the flag was actually here. I was simply not looking
in the right place. Perhaps new glasses or some rest should be my first 
resolution for 2012 !!!

sorry for the inconvenience

Eric

pellegrini a écrit :
> 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
>
>
> ------------------------------------------------------------------------
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


-- 
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France



More information about the CMake mailing list