[CMake] set_target_properties versus set_source_files_properties

pellegrini pellegrini at ill.fr
Wed Sep 22 08:09:30 EDT 2010


Hello everybody,

my question is in the title !

I want to create a fortran static library using the following set of g95 
compiler flags "-O3 -std=f2003 -funroll-loops -msse2"

If I use:

set_target_properties(my_static_lib PROPERTIES COMPILE_FLAGS "-O3 
-std=f2003 -funroll-loops -msse2")
or
set_source_files_properties(${SRC_FILES} PROPERTIES COMPILE_FLAGS "-O3 
-std=f2003 -funroll-loops -msse2")

where ${SRC_FILES} is the list of source files used to compile my static 
library, the result is the same when starting the make process.

So, in such a case is there a difference between those two functions ?

Another question I have is when applying one or the other function, this 
will duplicate some of the compiler flags (e.g. O3). The only way I 
found to avoid this is to do the following:

set(CMAKE_Fortran_FLAGS_RELEASE " ")                      
set_target_properties(crysfml PROPERTIES COMPILE_FLAGS "-O3 -std=f2003 
-funroll-loops -msse2")

so everything looks as if by default the CMAKE_Fortran_FLAGS_RELEASE 
variable was set to "-O3" and then, the value stored in the 
COMPILE_FLAGS variable was appended to it (so in that case "-O3" + "-O3 
-std=f2003 -funroll-loops -msse2" giving "-O3 -O3 -std=f2003 
-funroll-loops -msse2"). Am I right ?

thanks a lot

Eric

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



More information about the CMake mailing list