[CMake] using find_library with a ExternalProject
Ian Monroe
ian at monroe.nu
Sun Oct 21 22:20:48 EDT 2012
So I had code like:
include(ExternalProject)
ExternalProject_Add(
mockcpp
DOWNLOAD_COMMAND hg clone ssh://hg@bitbucket.org/godsme/mockcpp
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MOCKCPP_PREFIX}
UPDATE_COMMAND hg pull
)
find_library(MOCKCPP_LIBRARY
NAMES
mockcpp
PATHS
${MOCKCPP_PREFIX}/lib
NO_DEFAULT_PATH)
This worked just fine until I used it on a fresh build. Then cmake
wouldn't finish since at cmake-time the library doesn't exist.
So for now I just have switched to manually specify the library name
(${MOCKCPP_PREFIX}/lib/libmockcpp.a). But that's not portable at all,
I need to somehow tap into the platform independent foo inside
find_library. The library in question here is actually using cmake, so
another option would be to somehow use the targets of the external
project, but I didn't see a way to do it (ExternalProject_Get_Property
doesn't seem to be intended for that).
Thanks,
Ian Monroe
More information about the CMake
mailing list