In my project’s CMakeLists.txt I’m adding external projects like this:
externalproject_add(xxx GIT_REPOSITORY xxxrepo SOURCE_DIR ../../../3rdParty/xxx/src BUILD_DIR ../../../3rdParty/xxx/build)
externalproject_add(yyy GIT_REPOSITORY yyyrepo SOURCE_DIR ../../../3rdParty/yyy/src BUILD_DIR ../../../3rdParty/yyy/build)
The (out of tree) “3rdParty” folder already exists and has some other content. I would like CMake to add the folders “xxx” and “yyy” to this “3rdParty” folder. However, when I configure my project, what happens is that within the “3rdParty” folder, another “3rdParty” folder is created (perhaps because it already exists?). So the files end up in “…/…/…/3rdParty/3rdParty/xxx/src” and “…/…/…/3rdParty/3rdParty/yyy/src” etc instead of “…/…/…/3rdParty/xxx/src” and “…/…/…/3rdParty/yyy/src”.
I tried to create the folders before calling externalproject_add using file(MAKE_DIRECTORY …), which does work as expected. Now the folders are created correctly, but externalproject_add still creates its own 3rdParty/3Party folder puts everything there.
Am I doing something wrong or is this a bug? I would like to know how to fix it. Thanks in advance!
Edit: I’m running CMake 3.17.1 (cmake-gui) on Windows 10.