diff options
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 7 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/ChangeBuildType.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 9 |
5 files changed, 36 insertions, 6 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index d1577ac..b6c343c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1055,10 +1055,9 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies() } std::string cmGlobalNinjaGenerator::OrderDependsTargetForTarget( - cmGeneratorTarget const* target, const std::string& config) + cmGeneratorTarget const* target, const std::string& /*config*/) const { - return "cmake_object_order_depends_target_" + target->GetName() + "_" + - cmSystemTools::UpperCase(config); + return cmStrCat("cmake_object_order_depends_target_", target->GetName()); } void cmGlobalNinjaGenerator::AppendTargetOutputs( @@ -2679,3 +2678,10 @@ bool cmGlobalNinjaMultiGenerator::ReadCacheEntriesForBuild( return true; } + +std::string cmGlobalNinjaMultiGenerator::OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const +{ + return cmStrCat("cmake_object_order_depends_target_", target->GetName(), '_', + cmSystemTools::UpperCase(config)); +} diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 5668dd1..b89fb8f 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -315,8 +315,8 @@ public: ASD.insert(deps.begin(), deps.end()); } - static std::string OrderDependsTargetForTarget( - cmGeneratorTarget const* target, const std::string& config); + virtual std::string OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const; void AppendTargetOutputs( cmGeneratorTarget const* target, cmNinjaDeps& outputs, @@ -644,6 +644,9 @@ public: bool SupportsCrossConfigs() const override { return true; } bool SupportsDefaultConfigs() const override { return true; } + std::string OrderDependsTargetForTarget( + cmGeneratorTarget const* target, const std::string& config) const override; + protected: bool OpenBuildFileStreams() override; void CloseBuildFileStreams() override; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index abf12f8..486ed8d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -142,7 +142,7 @@ bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang) const std::string cmNinjaTargetGenerator::OrderDependsTargetForTarget( const std::string& config) { - return cmGlobalNinjaGenerator::OrderDependsTargetForTarget( + return this->GetGlobalGenerator()->OrderDependsTargetForTarget( this->GeneratorTarget, config); } diff --git a/Tests/RunCMake/Ninja/ChangeBuildType.cmake b/Tests/RunCMake/Ninja/ChangeBuildType.cmake new file mode 100644 index 0000000..80405a8 --- /dev/null +++ b/Tests/RunCMake/Ninja/ChangeBuildType.cmake @@ -0,0 +1,12 @@ +enable_language(C) + +function(change_build_type_subdir) + set(CMAKE_BUILD_TYPE Release) + add_subdirectory(SubDirPrefix) +endfunction() + +change_build_type_subdir() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +add_executable(hello hello_sub_greeting.c) +target_link_libraries(hello greeting) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index a00d830..0eada08 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -307,3 +307,12 @@ function (run_PreventConfigureFileDupBuildRule) run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) endfunction() run_PreventConfigureFileDupBuildRule() + +function (run_ChangeBuildType) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeBuildType-build) + set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") + run_cmake(ChangeBuildType) + unset(RunCMake_TEST_OPTIONS) + run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) +endfunction() +run_ChangeBuildType() |