diff options
author | Brad King <brad.king@kitware.com> | 2006-04-11 20:55:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-04-11 20:55:49 (GMT) |
commit | 08289893b8590be41d0541af7644e737035aee54 (patch) | |
tree | 8ad52af77e4837c0f7fd936b6c52ca083f66c0c0 /Source/cmLocalVisualStudio6Generator.cxx | |
parent | e380bad5f6fbe37048e3f06e125e2938da9ffc68 (diff) | |
download | CMake-08289893b8590be41d0541af7644e737035aee54.zip CMake-08289893b8590be41d0541af7644e737035aee54.tar.gz CMake-08289893b8590be41d0541af7644e737035aee54.tar.bz2 |
ENH: Split CMAKE_STANDARD_LIBRARIES into per-language variables CMAKE_<lang>_STANDARD_LIBRARIES. This is needed to get programmable language support working with Visual Studio generators. It makes sense anyway.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b6fd4f8..6fa2a9a 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1059,17 +1059,38 @@ void cmLocalVisualStudio6Generator libMultiLineOptionsForDebug += extraLinkOptions; libMultiLineOptionsForDebug += " \n"; } - if(const char* stdLibs = this->Makefile->GetDefinition("CMAKE_STANDARD_LIBRARIES")) + if(target.GetType() >= cmTarget::EXECUTABLE && + target.GetType() <= cmTarget::MODULE_LIBRARY) { - libOptions += " "; - libOptions += stdLibs; - libOptions += " "; - libMultiLineOptions += "# ADD LINK32 "; - libMultiLineOptions += stdLibs; - libMultiLineOptions += " \n"; - libMultiLineOptionsForDebug += "# ADD LINK32 "; - libMultiLineOptionsForDebug += stdLibs; - libMultiLineOptionsForDebug += " \n"; + // Get the language to use for linking. + const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); + if(!linkLanguage) + { + cmSystemTools::Error("CMake can not determine linker language for target:", + target.GetName()); + return; + } + + // Compute the variable name to lookup standard libraries for this + // language. + std::string standardLibsVar = "CMAKE_"; + standardLibsVar += linkLanguage; + standardLibsVar += "_STANDARD_LIBRARIES"; + + // Add standard libraries. + if(const char* stdLibs = + this->Makefile->GetDefinition(standardLibsVar.c_str())) + { + libOptions += " "; + libOptions += stdLibs; + libOptions += " "; + libMultiLineOptions += "# ADD LINK32 "; + libMultiLineOptions += stdLibs; + libMultiLineOptions += " \n"; + libMultiLineOptionsForDebug += "# ADD LINK32 "; + libMultiLineOptionsForDebug += stdLibs; + libMultiLineOptionsForDebug += " \n"; + } } if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS")) { |