diff options
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 2 | ||||
-rw-r--r-- | Source/cmState.cxx | 2 | ||||
-rw-r--r-- | Source/cmState.h | 1 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 7 |
10 files changed, 18 insertions, 4 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 1f7776c..70ed648 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -77,7 +77,7 @@ int main(int argc, char const* const* argv) cmDocumentation doc; doc.addCMakeStandardDocSections(); if (doc.CheckOptions(argc, argv)) { - cmake hcm(cmake::RoleInternal, cmState::Unknown); + cmake hcm(cmake::RoleInternal, cmState::Help); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index fb12b7d..591b793 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -79,7 +79,7 @@ int main(int argc, char** argv) doc.addCMakeStandardDocSections(); if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) { // Construct and print requested documentation. - cmake hcm(cmake::RoleInternal, cmState::Unknown); + cmake hcm(cmake::RoleInternal, cmState::Help); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3d38e73..17ee7f3 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -786,6 +786,8 @@ std::string cmState::ModeToString(cmState::Mode mode) return "CTEST"; case CPack: return "CPACK"; + case Help: + return "HELP"; case Unknown: return "UNKNOWN"; } diff --git a/Source/cmState.h b/Source/cmState.h index 2d0c521..9a17b22 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -53,6 +53,7 @@ public: FindPackage, CTest, CPack, + Help }; enum class ProjectKind diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8798f02..73b8e88 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -196,7 +196,7 @@ cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind) this->AddProjectCommands(); } - if (mode == cmState::Project) { + if (mode == cmState::Project || mode == cmState::Help) { this->LoadEnvironmentPresets(); } diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index b754b72..928c1ba 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -208,7 +208,7 @@ int do_cmake(int ac, char const* const* av) doc.addCMakeStandardDocSections(); if (doc.CheckOptions(ac, av, "--")) { // Construct and print requested documentation. - cmake hcm(cmake::RoleInternal, cmState::Unknown); + cmake hcm(cmake::RoleInternal, cmState::Help); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt b/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt new file mode 100644 index 0000000..cdfe857 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-bad-help-stderr.txt @@ -0,0 +1 @@ +CMake Error: CMAKE_GENERATOR was set but the specified generator doesn't exist. Using CMake default. diff --git a/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt new file mode 100644 index 0000000..075c48c --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-bad-help-stdout.txt @@ -0,0 +1,2 @@ +Generators.* +\* (Unix Makefiles|Visual Studio).* diff --git a/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt b/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt new file mode 100644 index 0000000..ece6e5d --- /dev/null +++ b/Tests/RunCMake/CommandLine/Envgen-ninja-multi-help-stdout.txt @@ -0,0 +1 @@ +\* Ninja Multi-Config[ ]+= Generates build-<Config>.ninja files. diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 50b1f90..327b772 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -349,6 +349,13 @@ function(run_EnvironmentGenerator) run_cmake_command(Envgen-bad ${CMAKE_COMMAND} -G) unset(ENV{CMAKE_GENERATOR}) + # Honor CMAKE_GENERATOR env var in --help output + set(ENV{CMAKE_GENERATOR} "Ninja Multi-Config") + run_cmake_command(Envgen-ninja-multi-help ${CMAKE_COMMAND} --help) + set(ENV{CMAKE_GENERATOR} "NoSuchGenerator") + run_cmake_command(Envgen-bad-help ${CMAKE_COMMAND} --help) + unset(ENV{CMAKE_GENERATOR}) + if(RunCMake_GENERATOR MATCHES "Visual Studio.*") set(ENV{CMAKE_GENERATOR} "${RunCMake_GENERATOR}") run_cmake_command(Envgen ${CMAKE_COMMAND} ${source_dir}) |