summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx40
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx15
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx15
-rw-r--r--Templates/staticLibHeader.dsptemplate8
-rw-r--r--Tests/CMakeLists.txt3
7 files changed, 77 insertions, 13 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index d7ffcf7..539816d 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1381,11 +1381,43 @@ void cmLocalVisualStudio6Generator
cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str());
}
std::string staticLibOptions;
+ std::string staticLibOptionsDebug;
+ std::string staticLibOptionsRelease;
+ std::string staticLibOptionsMinSizeRel;
+ std::string staticLibOptionsRelWithDebInfo;
if(target.GetType() == cmTarget::STATIC_LIBRARY )
{
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
{
staticLibOptions = libflags;
+ staticLibOptionsDebug = libflags;
+ staticLibOptionsRelease = libflags;
+ staticLibOptionsMinSizeRel = libflags;
+ staticLibOptionsRelWithDebInfo = libflags;
+ }
+ if(const char* libflagsDebug =
+ target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG"))
+ {
+ staticLibOptionsDebug += " ";
+ staticLibOptionsDebug = libflagsDebug;
+ }
+ if(const char* libflagsRelease =
+ target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE"))
+ {
+ staticLibOptionsRelease += " ";
+ staticLibOptionsRelease = libflagsRelease;
+ }
+ if(const char* libflagsMinSizeRel =
+ target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL"))
+ {
+ staticLibOptionsMinSizeRel += " ";
+ staticLibOptionsMinSizeRel = libflagsMinSizeRel;
+ }
+ if(const char* libflagsRelWithDebInfo =
+ target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO"))
+ {
+ staticLibOptionsRelWithDebInfo += " ";
+ staticLibOptionsRelWithDebInfo = libflagsRelWithDebInfo;
}
}
@@ -1417,6 +1449,14 @@ void cmLocalVisualStudio6Generator
mfcFlag);
if(target.GetType() == cmTarget::STATIC_LIBRARY )
{
+ cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG",
+ staticLibOptionsDebug.c_str());
+ cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELEASE",
+ staticLibOptionsRelease.c_str());
+ cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_MINSIZEREL",
+ staticLibOptionsMinSizeRel.c_str());
+ cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELWITHDEBINFO",
+ staticLibOptionsRelWithDebInfo.c_str());
cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS",
staticLibOptions.c_str());
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 2d8197c..136c177 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -915,7 +915,20 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n";
- if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
+
+ std::string libflags;
+ if(const char* flags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
+ {
+ libflags += flags;
+ }
+ std::string libFlagsConfig = "STATIC_LIBRARY_FLAGS_";
+ libFlagsConfig += configTypeUpper;
+ if(const char* flagsConfig = target.GetProperty(libFlagsConfig.c_str()))
+ {
+ libflags += " ";
+ libflags += flagsConfig;
+ }
+ if(!libflags.empty())
{
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index d3e6e11..dff91fe 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -122,6 +122,10 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
std::string extraFlags;
this->LocalGenerator->AppendFlags
(extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS"));
+ std::string staticLibraryFlagsConfig = "STATIC_LIBRARY_FLAGS_";
+ staticLibraryFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
+ this->LocalGenerator->AppendFlags
+ (extraFlags, this->Target->GetProperty(staticLibraryFlagsConfig.c_str()));
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false);
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 54b1815..45ba358 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -708,6 +708,11 @@ void cmTarget::DefineProperties(cmake *cm)
"Extra flags to use when linking a static library.");
cm->DefineProperty
+ ("STATIC_LIBRARY_FLAGS_<CONFIG>", cmProperty::TARGET,
+ "Per-configuration flags for creating a static library.",
+ "This is the configuration-specific version of STATIC_LIBRARY_FLAGS.");
+
+ cm->DefineProperty
("SUFFIX", cmProperty::TARGET,
"What comes after the library name.",
"A target property that can be set to override the suffix "
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 13bbc74..53d6594 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1023,22 +1023,27 @@ WriteRCOptions(std::string const& ,
}
-void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const&
- )
+void
+cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
{
return;
}
- if(const char* libflags = this->Target
- ->GetProperty("STATIC_LIBRARY_FLAGS"))
+ const char* libflags = this->Target->GetProperty("STATIC_LIBRARY_FLAGS");
+ std::string flagsConfigVar = "STATIC_LIBRARY_FLAGS_";
+ flagsConfigVar += cmSystemTools::UpperCase(config);
+ const char* libflagsConfig =
+ this->Target->GetProperty(flagsConfigVar.c_str());
+ if(libflags || libflagsConfig)
{
this->WriteString("<Lib>\n", 2);
cmVisualStudioGeneratorOptions
libOptions(this->LocalGenerator, 10,
cmVisualStudioGeneratorOptions::Linker,
cmVS10LibFlagTable, 0, this);
- libOptions.Parse(libflags);
+ libOptions.Parse(libflags?libflags:"");
+ libOptions.Parse(libflagsConfig?libflagsConfig:"");
libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
libOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Lib>\n", 2);
diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate
index 1b5c8bc..16b784e 100644
--- a/Templates/staticLibHeader.dsptemplate
+++ b/Templates/staticLibHeader.dsptemplate
@@ -67,7 +67,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELEASE/OUTPUT_NAME_RELEASE" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELEASE/OUTPUT_NAME_RELEASE" CM_STATIC_LIB_ARGS_RELEASE
CMAKE_CUSTOM_RULE_CODE_RELEASE
@@ -97,7 +97,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_DEBUG/OUTPUT_NAME_DEBUG" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_DEBUG/OUTPUT_NAME_DEBUG" CM_STATIC_LIB_ARGS_DEBUG
CMAKE_CUSTOM_RULE_CODE_DEBUG
@@ -128,7 +128,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_MINSIZEREL/OUTPUT_NAME_MINSIZEREL" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_MINSIZEREL/OUTPUT_NAME_MINSIZEREL" CM_STATIC_LIB_ARGS_MINSIZEREL
CMAKE_CUSTOM_RULE_CODE_MINSIZEREL
@@ -158,7 +158,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELWITHDEBINFO/OUTPUT_NAME_RELWITHDEBINFO" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELWITHDEBINFO/OUTPUT_NAME_RELWITHDEBINFO" CM_STATIC_LIB_ARGS_RELWITHDEBINFO
CMAKE_CUSTOM_RULE_CODE_RELWITHDEBINFO
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 0761486..0eec0c8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -202,9 +202,6 @@ IF(BUILD_TESTING)
ADD_LINK_FLAGS_TEST(dll_config lib_config)
ADD_LINK_FLAGS_TEST(exe_config dll_config)
- # STATIC_LIBRARY_FLAGS_<CONFIG> not yet implemented
- SET_TESTS_PROPERTIES(LinkFlags-lib_config PROPERTIES WILL_FAIL 1)
-
# If we are running right now with a UnixMakefiles based generator,
# build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately),