diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2012-02-19 21:38:10 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-02-19 23:20:03 (GMT) |
commit | a1a30340a2eb0174f9f6911ee1e2cf4a36eaac96 (patch) | |
tree | cc1903a317419d0fc35505bee3e50647ffe67ba1 /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 21997cea4d8694077e8bcf9ba4cbd3d96a3f163c (diff) | |
download | CMake-a1a30340a2eb0174f9f6911ee1e2cf4a36eaac96.zip CMake-a1a30340a2eb0174f9f6911ee1e2cf4a36eaac96.tar.gz CMake-a1a30340a2eb0174f9f6911ee1e2cf4a36eaac96.tar.bz2 |
Ninja: Import library support for Windows
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 66714e9..9294a01 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -172,10 +172,6 @@ cmNinjaNormalTargetGenerator i != linkCmds.end(); ++i) { -#ifdef _WIN32 - // TODO TARGET_IMPLIB is empty - cmSystemTools::ReplaceString(*i, "/implib:", ""); -#endif this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); } linkCmds.insert(linkCmds.begin(), "$PRE_LINK"); @@ -314,6 +310,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetTarget()->GetFullPath(this->GetConfigName(), /*implib=*/false, /*realpath=*/true).c_str()); + std::string targetOutputImplib = ConvertToNinjaPath( + this->GetTarget()->GetFullPath(this->GetConfigName(), + /*implib=*/true).c_str()); // Compute the comment. std::ostringstream comment; @@ -357,6 +356,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } + if (!this->TargetNameImport.empty()) { + vars["TARGET_IMPLIB"] = this->GetLocalGenerator()->ConvertToOutputFormat( + targetOutputImplib.c_str(), cmLocalGenerator::SHELL); + } + std::vector<cmCustomCommand> *cmdLists[3] = { &this->GetTarget()->GetPreBuildCommands(), &this->GetTarget()->GetPreLinkCommands(), @@ -434,6 +438,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } + if (!this->TargetNameImport.empty()) { + // Since using multiple outputs would mess up the $out variable, use an + // alias for the import library. + cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(), + "Alias for import library.", + cmNinjaDeps(1, targetOutputImplib), + cmNinjaDeps(1, targetOutputReal)); + } + // Add aliases for the file name and the target name. this->GetGlobalGenerator()->AddTargetAlias(this->TargetNameOut, this->GetTarget()); |