I would like to have all the external projects under the same directory. A ThirdParty
folder placed at the rood of cmake_binary_dir
. When using ExternalProject_Add
, this can be done locally to each project using [PREFIX dir]
or globally as follows:
# Set default ExternalProject root directory
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/ThirdParty)
However when using DownloadProject, this EP_PREFIX has no effect even when forced like this:
download_project(PROJ googletest
PREFIX "ThirdParty"
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
The project is downloaded at ./ThirdParty/googletest-download
indeed, but then CMake crushes since ./ThirdParty/googletest-src
is not created.
-- Build files have been written to: /tmp/DownloadProject/build/ThirdParty/googletest-download
Scanning dependencies of target googletest-download
[ 11%] Creating directories for 'googletest-download'
[ 22%] Performing download step (git clone) for 'googletest-download'
Cloning into 'googletest-src'...
Already on 'master'
Your branch is up-to-date with 'origin/master'.
[ 33%] No patch step for 'googletest-download'
[ 44%] Skipping update step for 'googletest-download'
[ 55%] No configure step for 'googletest-download'
[ 66%] No build step for 'googletest-download'
[ 77%] No install step for 'googletest-download'
[ 88%] No test step for 'googletest-download'
[100%] Completed 'googletest-download'
[100%] Built target googletest-download
CMake Error at CMakeLists.txt:25 (add_subdirectory):
add_subdirectory given source "ThirdParty/googletest-src" which is not an
existing directory.
What am I missing?