diff options
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 18 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 35 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 6 |
5 files changed, 27 insertions, 38 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 60ab3e4..6f0586b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -242,7 +242,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule() /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ true, + /*restat*/ "1", /*generator*/ false); } @@ -309,7 +309,7 @@ cmGlobalNinjaGenerator::AddMacOSXContentRule() /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } @@ -344,7 +344,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator) { // Make sure the rule has a name. @@ -408,10 +408,10 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, os << "rspfile_content = " << rspcontent << "\n"; } - if(restat) + if(!restat.empty()) { cmGlobalNinjaGenerator::Indent(os, 1); - os << "restat = 1\n"; + os << "restat = " << restat << "\n"; } if(generator) @@ -607,7 +607,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name, const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator) { // Do not add the same rule twice. @@ -1122,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ true); cmLocalNinjaGenerator *ng = static_cast<cmLocalNinjaGenerator *>(lg); @@ -1206,7 +1206,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ false); WriteBuild(os, "Clean all the built files.", @@ -1229,7 +1229,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ false, + /*restat=*/ "", /*generator=*/ false); WriteBuild(os, "Print all primary targets available.", diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index a166938..3d443d8 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -125,7 +125,7 @@ public: const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator); /** @@ -245,7 +245,7 @@ public: const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - bool restat, + const std::string& restat, bool generator); bool HasRule(const std::string& name); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 0cc3e3b..48c4a2d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -194,12 +194,7 @@ cmNinjaNormalTargetGenerator vars.ObjectDir = "$OBJECT_DIR"; - // TODO: - // Makefile generator expands <TARGET> to the plain target name - // with suffix. $out expands to a relative path. This difference - // could make trouble when switching to Ninja generator. Maybe - // using TARGET_NAME and RuleVariables::TargetName is a fix. - vars.Target = "$out"; + vars.Target = "$TARGET_FILE"; vars.SONameFlag = "$SONAME_FLAG"; vars.TargetSOName = "$SONAME"; @@ -252,7 +247,7 @@ cmNinjaNormalTargetGenerator << this->GetVisibleTypeName() << "."; cmOStringStream description; description << "Linking " << this->TargetLinkLanguage << " " - << this->GetVisibleTypeName() << " $out"; + << this->GetVisibleTypeName() << " $TARGET_FILE"; this->GetGlobalGenerator()->AddRule(ruleName, linkCmd, description.str(), @@ -261,7 +256,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", rspfile, rspcontent, - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } @@ -283,7 +278,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); else this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_LIBRARY", @@ -297,7 +292,7 @@ cmNinjaNormalTargetGenerator /*deptype*/ "", /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } } @@ -326,7 +321,7 @@ cmNinjaNormalTargetGenerator this->GetLocalGenerator()->ConvertToOutputFormat( mf->GetRequiredDefinition("CMAKE_COMMAND"), cmLocalGenerator::SHELL); - linkCmds.push_back(cmakeCommand + " -E remove $out"); + linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE"); } // TODO: Use ARCHIVE_APPEND for archives over a certain size. { @@ -450,6 +445,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetConfigName()); bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE"); cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); + + vars["TARGET_FILE"] = + localGen.ConvertToOutputFormat(targetOutputReal, cmLocalGenerator::SHELL); + localGen.GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], @@ -509,6 +508,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmLocalGenerator::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); + if(target.HasImportLibrary()) + { + outputs.push_back(targetOutputImplib); + } } if (!this->SetMsvcTargetPdbVariable(vars)) @@ -659,16 +662,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } - if (!this->TargetNameImport.empty()) - { - // Since using multiple outputs would mess up the $out variable, use an - // alias for the import library. - globalGen.WritePhonyBuild(this->GetBuildFileStream(), - "Alias for import library.", - cmNinjaDeps(1, targetOutputImplib), - cmNinjaDeps(1, targetOutputReal)); - } - // Add aliases for the file name and the target name. globalGen.AddTargetAlias(this->TargetNameOut, &target); globalGen.AddTargetAlias(this->GetTargetName(), &target); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 80213d8..57fbcd3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -477,7 +477,7 @@ cmNinjaTargetGenerator deptype, /*rspfile*/ "", /*rspcontent*/ "", - /*restat*/ false, + /*restat*/ "", /*generator*/ false); } diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 8df331e..6209bb8 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -28,10 +28,6 @@ function(help_xcode_depends) endif() endfunction() -if("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(HELP_NINJA 1) # TODO Why is this needed? -endif() - # The Intel compiler causes the MSVC linker to crash during # incremental linking, so avoid the /INCREMENTAL:YES flag. if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") @@ -218,7 +214,7 @@ try_compile(RESULT OUTPUT_VARIABLE OUTPUT) # Xcode is in serious need of help here -if(HELP_XCODE OR HELP_NINJA) +if(HELP_XCODE) try_compile(RESULT ${BuildDepends_BINARY_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project |