1

I asked this question before (How to add a dependency on a file for the configure step of ExternalProject_Add in cmake) for the configure step.

Unfortunately, the answer that I got there does not work for the 'mkdir' step:

ExternalProject_Add_StepDependencies(
  gitache_package_libcwd_r
  download "/opt/gitache/libcwd_r/gitache-lock"
)

works fine, but when I use the internal (Using an ExternalProject download step with Ninja) step 'mkdir':

ExternalProject_Add_StepDependencies(
  gitache_package_libcwd_r
  mkdir "/opt/gitache/libcwd_r/gitache-lock"
)

I get the error:

CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2273 (message):
  External project "gitache_package_libcwd_r" does not have a step "mkdir".

How can I do this?

Carlo Wood
  • 5,648
  • 2
  • 35
  • 47

1 Answers1

1

I stumbled upon the same issue last week. After digging for some time I've found a bug in ExternalProject.cmake module and filed a pull request https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4640 .

You can patch your local version of that module until it's fixed upstream (Update, fix has been included to version 3.18.0)

UVV
  • 502
  • 8
  • 21
  • 1
    Great job! I completely abandoned using ExternalProject however - it didn't work well enough for me. Besides, I needed things to work during configure time, not build time :p (for my project https://github.com/CarloWood/gitache). – Carlo Wood Apr 22 '20 at 12:33
  • @CarloWood Actually I use a superbuild pattern and found this approach working really well. In that case everything is done _before_ configure. Take a look at the links below, hopefully you can find them useful too: https://stackoverflow.com/questions/51717207/building-mongo-cxx-driver-using-cmake-externalproject-add/51718660 https://github.com/Sarcasm/cmake-superbuild – UVV Apr 23 '20 at 13:45