[CMake] Using ExternalProject_Add when CMakeFiles.txt is not in the root directory.
Klaim - Joël Lamotte
mjklaim at gmail.com
Tue Jul 14 17:14:10 EDT 2015
I am attempting to use ExternalDependencies_Add with the last Protobuf
version (v3.0.0) which is in alpha3 (I'm using the master branch
actually)[1].
If you don't already know: contrary to previous Protobuf version, v3.x
provides
cmake scripts (and also makes CMake's FindProtobuf module unusuable if you
build Protobuf using CMake BTW).
I am having trouble figuring out how to ExternalProject_add work in this
case:
the CMakeFiles.txt is not in the root directory of Protobuf sources, it is
in ./cmake/ [2]
So at build time, after download, I obviously get:
>CUSTOMBUILD : CMake error : The source directory
"blahblah/install_protobuf" does not appear to contain CMakeLists.txt.
I tried several approaches using this as a base:
ExternalProject_Add( install_protobuf
PREFIX ${NETRUSH_DEPENDENCIES_DIR}/protobuf
GIT_REPOSITORY https://github.com/google/protobuf.git
GIT_TAG master
CMAKE_CACHE_ARGS
-DBUILD_TESTING:bool=FALSE
)
I tried setting SOURCE_DIR but failed to make it work mainly because I'm
not sure what value to set exactly, and
SOURCE_DIR cmake
Does not seem to work.
I was wondering if there is some args I could pass to CMake using CMAKE_ARGS
but from the cmake[3] page in the doc I don't see anything that match
exactly, or
I might be misunderstanding something.
I found this recommandation from Miklos Espak from 8th February 2015:
"Specify a patch command that creates a toplevel cmake list with one
'add_subdirectory(A)' line."
It seems to work, but it also means that the repository is modified, which
is something
I want to avoid. Also it's really a hack for passing the right working
directory to cmake.
Is there a simpler way to do it that I missed?
Thanks for your time.
Joël Lamotte
[1] https://github.com/google/protobuf
[2] https://github.com/google/protobuf/tree/master/cmake
[3] http://www.cmake.org/cmake/help/v3.3/manual/cmake.1.html#manual:cmake(1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150714/6d1438f3/attachment.html>
More information about the CMake
mailing list