ExternalProject removes SOURCE_DIR if GIT_URL is set
The documentaiton of ExternalProject_Add
states the following for SOURCE_DIR
:
If SOURCE_DIR is explicitly set to an existing directory the project will be built from it. Otherwise a download step must be specified using one of the DOWNLOAD_COMMAND, CVS_, SVN_, or URL options. The URL option may refer locally to a directory or source tarball, or refer to a remote tarball [...].
It appears that even though the SOURCE_DIR
exists, it will be removed and cloned if GIT_URL
is set.
Steps to reproduce:
$ mkdir my_project
$ cd my_project
$ mkdir ext_project
$ touch ext_project/IMPORTANT_FILE
$ vim CMakeLists.txt
$ mkdir build
$ cd build
$ cmake ..
$ make # interrupt as soon as external project has been cloned
$ ls ../ext_project # IMPORTANT_FILE is gone
# CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(my_project LANGUAGES CXX)
include(ExternalProject)
ExternalProject_Add(
ext_project
GIT_REPOSITORY https://github.com/allscale/allscale_api
SOURCE_DIR ${CMAKE_SOURCE_DIR}/ext_project
)
CMake Version: 3.5.1