From df847671b43f35162570db1e6f2801bc3b2de11a Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Sat, 17 Mar 2012 20:49:36 +0000 Subject: [PATCH] Ninja: add support for OBJECT_OUTPUTS, fix PrecompiledHeader test case --- Source/cmNinjaTargetGenerator.cxx | 11 +++++++++++ Tests/PrecompiledHeader/CMakeLists.txt | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b9f997dc4..9acbc676a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -475,6 +475,17 @@ cmNinjaTargetGenerator emptyDeps, orderOnlyDeps, vars); + + if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) { + std::vector outputList; + cmSystemTools::ExpandListArgument(objectOutputs, outputList); + std::transform(outputList.begin(), outputList.end(), outputList.begin(), + MapToNinjaPath()); + cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(), + "Additional output files.", + outputList, + outputs); + } } //---------------------------------------------------------------------------- diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index d423cae30..3374e325f 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -47,7 +47,8 @@ SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES # Setup dependencies for precompiled header creation and use. The VS # IDE takes care of this automatically. -IF("${CMAKE_GENERATOR}" MATCHES "Makefile") +IF("${CMAKE_GENERATOR}" MATCHES "Makefile" OR + "${CMAKE_GENERATOR}" MATCHES "Ninja") # This source file creates the precompiled header as a side-effect. SET_SOURCE_FILES_PROPERTIES(foo_precompile.c PROPERTIES OBJECT_OUTPUTS "${PCH_DIR}/foo_precompiled.pch")