[CMake] Re: Retrieving target's sources and libraries

Rodolfo Schulz de Lima rodolfo at rodsoft.org
Mon Dec 17 12:45:10 EST 2007


First of all, thanks for the relatively quick commit of this feature to 
cmake-cvs!

Brad King escreveu:
> Thanks, we're looking at the patch.  We typically have constructed the
> set of source files for a target in a variable so they can be used later:
> 
> SET(mylib_SOURCES
>   mylib1.c
>   mylib2.c
>   )
> ADD_LIBRARY(mylib ${mylib_SOURCES})
> SET_SOURCE_FILES_PROPERTIES(${mylib_SOURCES} PROPERTIES ...)

As I'm creating a macro to enable pch support, I cannot force the user 
to use a variable to store the target's source, I must get it directly 
using the target's name.

> There is help for you in CVS CMake.  We've added some primitives that
> make implementing PCH possible, though there is not yet an interface
> making it a first-class feature.

Thank you very much for your pointers. My macro is based on the one 
attached to the bug report #1260. The main difference is that my macro 
tries to minimize the number of precompiled headers created.
For instance, suppose you have 2 targets that use the same header, and 
have the same compiler flags. My solution would create only one 
precompiled header for both targets, while the former macro would create 
two.

Any further suggestions are welcome.

Regards,
rod



More information about the CMake mailing list