[CMake] ExternalProject dependency question
Dan Kegel
dank at kegel.com
Wed Oct 26 16:55:14 EDT 2011
The manual says
"If you need to make your own CMake target depend on an external
project use the CMake ADD_DEPENDENCIES command. The target name will
be the first argument and the external project <name> will be the
second argument."
But it seems kind of lame; it leaves external projects as second-class
citizens that need two statements to reference instead of one.
Isn't there a way to say "any project that uses
${CMAKE_BINARY_DIR}/prefix/lib/libblort.a dependes on Blort"?
More context:
I'm happily using ExternalProject_Add to compile something:
include(ExternalProject)
ExternalProject_Add(
Blort
SOURCE_DIR ${CMAKE_SOURCE_DIR}/blort
INSTALL_DIR ${CMAKE_BINARY_DIR}/prefix
CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/blort/configure -C
--prefix=${CMAKE_BINARY_DIR}/prefix "CFLAGS=-g -O2 -fPIC"
)
SET(Blort_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/blort)
SET(Blort_LIBRARIES ${CMAKE_BINARY_DIR}/prefix/lib/libblort.a)
Works fine... except that doing a "make -j9" with ccache just now,
a build failed because libblort.a wasn't made in time.
Looks like the code above doesn't end up adding the right
dependencies.
(Is this related to http://www.cmake.org/Bug/view.php?id=10395 ?)
- Dan
More information about the CMake
mailing list