[CMake] Building files with custom target

Pablo Yanez Trujillo shaoran at sakuranohana.org
Fri Nov 28 08:00:16 EST 2008


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

Hi

I've got a problem and it seems that there isn't any FAQ entry to solve my problem (or at least I'm to blind to find it).

I'm writting a library that has a set of modules (sub-libraries would match better) that depend on each other but are
installed as separated libraries. I mean, I have this directory structure:

mylib
 |
 |- module1
 |  |- test
 |  |  |- samples
 |  `  `
 |- module2
 |  |- test
 |  |  |- samples
 ...

In each CMakeLists.txt file of module{1,...n} I have a ADD_LIBRARY command and with TARGET_LINK_LIBRARY I set the
internal dependencies. Everything works fine in that way.

Each module has a test directory for unit-test and inside this directory a samples directory where you can find samples
(not only 'how to use module' but small applications). Those programs are not unit-test hence I don't want to use
add_test for them.

If I add (let's say in module2)

add_executable(tcp_server test/samples/server.c)
TARGET_LINK_LIBRARIES(tcp_server cu_tcp cu_thread)

in modules2/CMakeLists.txt then the 'tcp_server' target is built under 'make'. I don't want that those targets are built
automatically, but I don't know how to do this. Besides I want to create a custom target 'samples' so that iff I execute
'make samples' the sample-targets are built. I would like to let cmake build them because cmake tracks the dependencies
better. Is this possible at all?

Thanks
Pablo


- --
Pablo Yanez Trujillo
http://klingsor.informatik.uni-freiburg.de
My public key: http://klingsor.informatik.uni-freiburg.de/gpg/supertux.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkv62AACgkQDzf8xo+0xRUTTACeMfHyDnLk3/yFv0uhvJuq8N36
5jkAninNgaB3GKdV15Ccm42sJMq9MvKs
=jN9x
-----END PGP SIGNATURE-----


More information about the CMake mailing list