[CMake] Problem with set_target_properties on mixed-source library

Alexander Neundorf a.neundorf-work at gmx.net
Thu Oct 2 17:58:51 EDT 2008


On Monday 29 September 2008, Martin Apel wrote:
> Hi all,
>
> I have a library consisting of multiple sources from Fortran and C, e.g.
> file1.f, file2.f, file3.c.
> I want to generate this library in two different versions, where in one
> of those versions the Fortran files are compiled with different options,
> in my case with -ipo.
> That means:
>     libv1.a   = file1.o file2.o file3.o               compiled without
> ipo-options
>     libv2.a   = file1.o file2.o with ipo-option, file3.o without ipo-option
>
> I tried to use set_target_properties on libv2 to set the ipo-flag, but
> this also sets this option for the C files, which the compiler does not
> understand.
> I also cannot use set_source_properties, because the same source files
> will be compiled with different options.

Hmm, more a hack...
For C, you could do:
file3-with-other-options.c:
#include "file3.c"

and then use set_source_files_properties() on file3-with-other-options.c. 
Don't know about Fortran.

Alex


More information about the CMake mailing list