[Cmake] More control on CMake...

Nick Ton nton at photon . com
Thu, 11 Sep 2003 12:09:51 -0400


Hi,

In my project I have two executables, and four sub-directory libraries.
One of my executable target requires all four sub-directory libraries.
What commands should I use to explicitly describe this dependencies?
Also what commands can I use to explicitly describe the output directory
of my libraries without having the user run cmake -i?

The following is an example of my CMakeLists.txt:

PROJECT(MyProj)

SUBDIRS(dirlib1 dirlib2 dirlib3 dirlib4)

...

ADD_EXECUTABLES(target1_standalone ${TARGET_1SRC})

ADD_EXECUTABLES(target2_hasdependcy ${TARGET_2SRC})

SET {LIB_OUTPUT_DIR ./lib/g2/}

TARGET_LINK_LIBRARIES (target2_hasdependcy 
${LIB_OUTPUT_DIR}/lib1 
${LIB_OUTPUT_DIR}/lib2 
${LIB_OUTPUT_DIR}/lib3 
${LIB_OUTPUT_DIR}/lib4)

I haven't had much luck using TARGET_LINK_LIBRARIES to describe
the dependencies between target2 and all of my libraries. Basically,
I want to build the libraries first before target2 is built.

Thanks In Advance,
Nick