Crascit/DownloadProject

PREFIX causes add_subdirectories() to fail

Closed this issue · 5 comments

add_subdirectory given source "<prefix>/<PROJ>-src" which is not an existing directory.

Can you provide a complete example that reproduces the problem? There's not enough in that single line of output for me to have much of an idea what could be going wrong.

include(DownloadProject.cmake)

# Download Serial Wiring as source
download_project(
  PROJ serial_wiring
  PREFIX external <-----------------------------------------------THIS LINE BREAKS THE MODULE
  GIT_REPOSITORY https://github.com/remote-wiring/serial-wiring.git
  GIT_TAG master
  TIMEOUT 10
)
add_subdirectory(${serial_wiring_SOURCE_DIR} ${serial_wiring_BINARY_DIR})

You can check the source. If I remove it, then everything works fine. It just makes a mess out of my binary directory. It's not a big deal, but I thought I would mention it.

P.S. This module you wrote is a God send. Thank you!

Thanks for the extra info. I can now reproduce your problem. It is due to the supplied prefix being a relative path instead of an absolute one. This should be okay, but the values of serial_wiring_SOURCE_DIR and serial_wiring_BINARY_DIR are not being forced to be absolute paths like they should be. I'll push a fix shortly after it's been tested.

Fixed on master. Thanks for reporting and glad you found it useful.