diff options
author | Brad King <brad.king@kitware.com> | 2020-11-03 12:24:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-11-03 12:24:25 (GMT) |
commit | 855bdc586c2c8c6ed029c6d0e370e19e0b2e6193 (patch) | |
tree | 3a05526e42c11df7bc06cb4f9a0705d639dcf594 | |
parent | 37d75e5fdd1c045f97ea7cdeb0c5227b525f2b3f (diff) | |
parent | cb2d01c182d31d890990c2bcde1766d4fc65a318 (diff) | |
download | CMake-855bdc586c2c8c6ed029c6d0e370e19e0b2e6193.zip CMake-855bdc586c2c8c6ed029c6d0e370e19e0b2e6193.tar.gz CMake-855bdc586c2c8c6ed029c6d0e370e19e0b2e6193.tar.bz2 |
Merge topic 'cmake-presets-no-path-arg-warning' into release-3.19
cb2d01c182 CMakePresets.json: Don't warn if no path argument is given
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5455
-rw-r--r-- | Source/cmake.cxx | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/CMakePresets.json.in | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 7 |
4 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f4ab1b0..60a493c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1005,9 +1005,15 @@ void cmake::SetArgs(const std::vector<std::string>& args) const bool haveSourceDir = !this->GetHomeDirectory().empty(); const bool haveBinaryDir = !this->GetHomeOutputDirectory().empty(); + const bool havePreset = +#ifdef CMAKE_BOOTSTRAP + false; +#else + !presetName.empty(); +#endif if (this->CurrentWorkingMode == cmake::NORMAL_MODE && !haveSourceDir && - !haveBinaryDir) { + !haveBinaryDir && !havePreset) { this->IssueMessage( MessageType::WARNING, "No source or binary directory provided. Both will be assumed to be " diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index a347120..54e4140 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -170,6 +170,11 @@ "binaryDir": "${sourceDir}/build" }, { + "name": "GoodNoSourceArg", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + }, + { "name": "GoodInheritanceParentBase", "hidden": true, "generator": "@RunCMake_GENERATOR@", diff --git a/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake b/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake new file mode 100644 index 0000000..49e7a25 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/GoodNoSourceArg.cmake @@ -0,0 +1,3 @@ +include(${CMAKE_CURRENT_LIST_DIR}/TestVariable.cmake) + +test_variable(CMAKE_BINARY_DIR "" "${CMAKE_SOURCE_DIR}/build") diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 2caa66a..1ffda3d 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -179,6 +179,13 @@ unset(RunCMake_TEST_NO_CLEAN) unset(CMakePresets_SOURCE_ARG) unset(RunCMake_TEST_BINARY_DIR) unset(CMakePresets_NO_S_ARG) +set(CMakePresets_NO_SOURCE_ARGS 1) +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/GoodNoSourceArg") +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_presets(GoodNoSourceArg) +unset(RunCMake_TEST_NO_CLEAN) +unset(RunCMake_TEST_BINARY_DIR) +unset(CMakePresets_NO_SOURCE_ARGS) run_cmake_presets(GoodInheritanceParent) run_cmake_presets(GoodInheritanceChild) run_cmake_presets(GoodInheritanceOverride) |