diff options
author | Brad King <brad.king@kitware.com> | 2020-03-04 13:17:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-03-04 13:18:03 (GMT) |
commit | 26f728ca780ae195651a8e4d56a66c53d6da159a (patch) | |
tree | bcb926522d2914d7b634dadc9accfe6e623944f2 | |
parent | d674c3a5bc7599ad5cd974c13b655a7d36d9c5c9 (diff) | |
parent | 8b799f80e3d23653486a9feac7aa2929e0abebff (diff) | |
download | CMake-26f728ca780ae195651a8e4d56a66c53d6da159a.zip CMake-26f728ca780ae195651a8e4d56a66c53d6da159a.tar.gz CMake-26f728ca780ae195651a8e4d56a66c53d6da159a.tar.bz2 |
Merge topic 'ninja-multi-spurious-unused-variables'
8b799f80e3 Ninja Multi-Config: Fix spurious unused variable warning
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4421
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 3 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 86b1e0b..e59664b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2602,6 +2602,9 @@ void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs( bool cmGlobalNinjaMultiGenerator::InspectConfigTypeVariables() { + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_BUILD_TYPE"); + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_CROSS_CONFIGS"); + this->GetCMakeInstance()->MarkCliAsUsed("CMAKE_DEFAULT_CONFIGS"); return this->ReadCacheEntriesForBuild(*this->Makefiles.front()->GetState()); } diff --git a/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake new file mode 100644 index 0000000..bb7b160 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake @@ -0,0 +1 @@ +# Intentionally empty diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index b07b4f7..6472f46 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -78,8 +78,6 @@ endfunction() ############################################################################### -set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) # IMPORTANT: Setting RelWithDebInfo as the first item in CMAKE_CONFIGURATION_TYPES # generates a build.ninja file with that configuration @@ -203,6 +201,7 @@ unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) run_cmake_build(FrameworkDependencyAutogen framework Release test2:Debug) +set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandGenerator) @@ -219,6 +218,7 @@ run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TAR run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") +unset(RunCMake_TEST_NO_CLEAN) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") @@ -275,6 +275,16 @@ run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Deb #run_cmake_configure(AutoMocExecutable) #run_cmake_build(AutoMocExecutable debug-in-release-graph Release exe) +# Need to test this manually because run_cmake() adds --no-warn-unused-cli +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoUnusedVariables-build) +run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} + -G "Ninja Multi-Config" + "-DRunCMake_TEST=NoUnusedVariables" + "-DCMAKE_CROSS_CONFIGS=all" + "-DCMAKE_DEFAULT_BUILD_TYPE=Debug" + "-DCMAKE_DEFAULT_CONFIGS=all" + ) + if(CMake_TEST_CUDA) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) run_cmake_configure(CudaSimple) |