diff options
author | Craig Scott <craig.scott@crascit.com> | 2022-10-27 07:44:01 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-10-27 07:44:01 (GMT) |
commit | 6b6d59335160fedb2c0eb0f33464033651def43d (patch) | |
tree | 999a9bfb3e99b6ab56af50a3e2358bdacbe52bce /Modules | |
parent | f2432780b3fd92bbaa8194ce7577cc4797b695ff (diff) | |
download | CMake-6b6d59335160fedb2c0eb0f33464033651def43d.zip CMake-6b6d59335160fedb2c0eb0f33464033651def43d.tar.gz CMake-6b6d59335160fedb2c0eb0f33464033651def43d.tar.bz2 |
ExternalProject: Use -S and -B args to robustly set configure dirs
Previously, the build directory was not explicitly specified. Instead, the
current working directory was assumed to be the build directory and the
source directory was passed as a positional argument. However, if the
source directory contained a CMakeCache.txt, it was treated as a binary
directory instead. For the scenario where a project is built in-source and
it calls ExternalProject_Add() with its own source directory but a different
build directory (e.g. to build itself with a different set of configure arguments),
this results in a build error.
Explicitly list both the source and build directories using the -S and -B options
respectively. This unambiguously sets both, avoiding the above problem.
Fixes: #24081
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/ExternalProject.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 22a25bd..141b185 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -3642,7 +3642,7 @@ function(_ep_extract_configure_command var name) ) endif() - list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>") + list(APPEND cmd -S "<SOURCE_DIR><SOURCE_SUBDIR>" -B "<BINARY_DIR>") endif() set("${var}" "${cmd}" PARENT_SCOPE) |