[CMake] add_subdiretory() help
Andreas Pakulat
apaku at gmx.de
Mon Dec 3 04:28:30 EST 2007
On 03.12.07 11:12:33, Ramazan Girgin wrote:
> Hi all,
> I want to use function like add_subdirectory for build order. I have 3
> modul. Modul_A and Modul_B must be built before building Module_C .But
> Modul_A,Modul_B and Modul_C are at the same level.When i used
> ADD_SUBDIRECTORY(../Modul_A) and ADD_SUBDIRECTORY(../Modul_B) in
The CMakeLists.txt with the add_subdirectory commands should sit at the
same level as the 3 module directories.
> CMakelists.txt file in Modul_C cmake gives error. Error is Modul_A and
> Modul_B is not subdirectory of Modul_C. Every modul is have
> CMakeLists.txtfiles and build different
> libraries.This is library dependency for me.
So some of the libraries in module C depend on libraries in module A or
B? If so, you should express that in the target_link_libraries command
by naming the targets of the libraries that the libs in C link to, i.e.:
add_library(modC_foo)
target_link_libraries(modC_foo modA_bar modB_baz)
Then CMake will figure out the right order of building the libraries in
modules A and B for you.
Andreas
--
Try to get all of your posthumous medals in advance.
More information about the CMake
mailing list