On Nov 28, 2008, at 8:00 AM, Pablo Yanez Trujillo wrote:

-----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


One way to do this is to introduce an "option" to cmake:

# BUILD_SAMPLES is default to OFF
option(BUILD_SAMPLES "Build the sample Applications" OFF)

Now during ccmake or cmake time the user can select the BUILD_SAMPLES and turn it on.

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

This is one way of putting the logic directly into the cmake code.

_________________________________________________________
Mike Jackson                  [EMAIL PROTECTED]
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to