[CMake] Saving/Restoring link_directories and link_libraries

Theodore Papadopoulo Theodore.Papadopoulo at inria.fr
Fri Jun 1 09:30:32 EDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	Hi,

I'm using a library XXX which comes with UseXXX.cmake and
XXXConfig.cmake files (which I cannot touch as they come from linux
distributions).

Unfortunately, the XXXConfig.cmake directly calls
include_directories(), add_definitions(), link_directories() and
link_libraries().

The last two are particularly unwelcome as they force the link of all
the executables with the XXX libraries whereas I only need them in one
such executable.

So my question is, is there a way/trick to save the state of these 4
quantities (link_directories, definitions, link_directories and
link_libraries) before the FindPackage(XXX) call and to restore to
these saved values after the call.

I hope for sthg like a property but I cannot find it (even looking at
the sources).

Otherwise, the only simple option I have is to call the
FindPackage(XXX) at the latest possible time. But this is rather
fragile IMHO.

	Thank's a lot for any insight,

	Theo.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAk/Iw/gACgkQEr8WrU8nPV2YUQCYtAhKbIR6V+dKf4ZAcKMVt7+o
9QCfbC49rP3wc8pdIholZba1JyCg08w=
=hd7B
-----END PGP SIGNATURE-----


More information about the CMake mailing list