diff options
author | Craig Scott <craig.scott@crascit.com> | 2022-04-28 13:00:19 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-05-03 06:48:11 (GMT) |
commit | 29e31e2825a2cd5099b8abe66f4816919cec934a (patch) | |
tree | a1590254fba9ed2a4e5e80b6725fc3f9795ac269 /Source/cmake.cxx | |
parent | 1d82670bd4daff26d0d0169820b289bc401f4943 (diff) | |
download | CMake-29e31e2825a2cd5099b8abe66f4816919cec934a.zip CMake-29e31e2825a2cd5099b8abe66f4816919cec934a.tar.gz CMake-29e31e2825a2cd5099b8abe66f4816919cec934a.tar.bz2 |
Packages: Integrate FetchContent and find_package()
Allow FetchContent_MakeAvailable() to try a call to
find_package() first, or redirect a find_package() call to
FetchContent_MakeAvailable(). The user can set variables
to control which of these are allowed or tried by default.
Fixes: #21687
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1c027ad..a8dc963 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2103,6 +2103,21 @@ int cmake::ActualConfigure() cmStateEnums::INTERNAL); } + // We want to create the package redirects directory as early as possible, + // but not before pre-configure checks have passed. This ensures we get + // errors about inappropriate source/binary directories first. + const auto redirectsDir = + cmStrCat(this->GetHomeOutputDirectory(), "/CMakeFiles/pkgRedirects"); + cmSystemTools::RemoveADirectory(redirectsDir); + if (!cmSystemTools::MakeDirectory(redirectsDir)) { + cmSystemTools::Error( + "Unable to (re)create the private pkgRedirects directory:\n" + + redirectsDir); + return -1; + } + this->AddCacheEntry("CMAKE_FIND_PACKAGE_REDIRECTS_DIR", redirectsDir, + "Value Computed by CMake.", cmStateEnums::STATIC); + // no generator specified on the command line if (!this->GlobalGenerator) { cmValue genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); |