[CMake] Globbing expression

Tyler Roscoe tyler at cryptio.net
Mon Jul 13 10:49:21 EDT 2009


On Mon, Jul 13, 2009 at 02:08:29PM +0200, Arnaud Devalkeneer wrote:
> Another should be :
> - make a second GLOB expression gathering all libraries you do not need
> - make a LIST( REMOVE_ITEM FIRST_GLOB_RESULT SECOND_BLOG_RESULT)
> but I suspect your solution is much efficient...

Yeah I would do it the way Marcel proposed.

> One additionnal question : do you know how to trigger the GLOB command just
> before a link target handling.
> Because in my case, the GLOB command is running at the beginning of the
> compilation process, regardless
> the fact that I need to link to some .so's that have not been built yet.
> Is a custom target is a right way?

First of all, using file(GLOB ...) to collect lists of files to process
is not a best practice because CMake then can't know if you've added or
removed files from this list and can't know if it needs to reprocess
your CMakeLists. Check the docs for more info.

Either way, if you know what those .so's are (and you obviously do since
you're going to build them), just add those names to your list of
libraries. If you just use the target name ("libfoo", not
"/path/to/libfoo.so"), CMake will figure out the path and any suffixes
or other shenanigans for you.

tyler


More information about the CMake mailing list