[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3453-ge56389d
Patrick Gansterer
paroga at paroga.com
Mon Jul 29 03:10:24 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via e56389dafebd7317c9c6a5c6a59cc271b4c5587a (commit)
via 3b581e0252c4f864b44d8ad027e07d11c4132c0f (commit)
via bd588112b262bf06344b9d6ecf4e5a626a1cec38 (commit)
via dcc753d71fddd679e5d776936a8ce234eaee4098 (commit)
via 23957a870e4a4a3f84578eab87503b922c6036d0 (commit)
via f1081f551856b3d2619c9901b9641eb28f0854e1 (commit)
from 1f270cad85205759e1b9bd27a1067ea747db1c4e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e56389dafebd7317c9c6a5c6a59cc271b4c5587a
commit e56389dafebd7317c9c6a5c6a59cc271b4c5587a
Merge: 1f270ca 3b581e0
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Mon Jul 29 03:10:21 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Jul 29 03:10:21 2013 -0400
Merge topic 'static_library_flags' into next
3b581e0 Add additonal tests for the linker flags
bd58811 Add documentation for the missing CMAKE_*_LINKER_FLAGS_* variables
dcc753d Add CMAKE_STATIC_LINKER_FLAGS to CMakeCommonLanguageInclude
23957a8 Add support for CMAKE_STATIC_LINKER_FLAGS
f1081f5 Unify the way the flags of a static library are read
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b581e0252c4f864b44d8ad027e07d11c4132c0f
commit 3b581e0252c4f864b44d8ad027e07d11c4132c0f
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Sun Jul 28 20:34:16 2013 +0200
Commit: Patrick Gansterer <paroga at paroga.com>
CommitDate: Sun Jul 28 20:39:03 2013 +0200
Add additonal tests for the linker flags
Extend Tests/LinkFlags to test libraries of the type MODULE and
the content of the CMAKE_*_LINKER_FLAGS_* variables.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 440cdf0..16693de 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -394,10 +394,20 @@ if(BUILD_TESTING)
endmacro()
ADD_LINK_FLAGS_TEST(lib prepare)
ADD_LINK_FLAGS_TEST(dll lib)
- ADD_LINK_FLAGS_TEST(exe dll)
+ ADD_LINK_FLAGS_TEST(mod dll)
+ ADD_LINK_FLAGS_TEST(exe mod)
ADD_LINK_FLAGS_TEST(lib_config exe)
ADD_LINK_FLAGS_TEST(dll_config lib_config)
- ADD_LINK_FLAGS_TEST(exe_config dll_config)
+ ADD_LINK_FLAGS_TEST(mod_config dll_config)
+ ADD_LINK_FLAGS_TEST(exe_config mod_config)
+ ADD_LINK_FLAGS_TEST(lib_flags exe_config)
+ ADD_LINK_FLAGS_TEST(dll_flags lib_flags)
+ ADD_LINK_FLAGS_TEST(mod_flags dll_flags)
+ ADD_LINK_FLAGS_TEST(exe_flags mod_flags)
+ ADD_LINK_FLAGS_TEST(lib_flags_config exe_flags)
+ ADD_LINK_FLAGS_TEST(dll_flags_config lib_flags_config)
+ ADD_LINK_FLAGS_TEST(mod_flags_config dll_flags_config)
+ ADD_LINK_FLAGS_TEST(exe_flags_config mod_flags_config)
# If we are running right now with a UnixMakefiles based generator,
# build the "Simple" test with the ExtraGenerators, if available
diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt
index e06020c..4607035 100644
--- a/Tests/LinkFlags/CMakeLists.txt
+++ b/Tests/LinkFlags/CMakeLists.txt
@@ -13,6 +13,9 @@ set_property(TARGET LinkFlags_lib PROPERTY STATIC_LIBRARY_FLAGS ${pre}BADFLAG${o
add_library(LinkFlags_dll SHARED LinkFlagsLib.c)
set_property(TARGET LinkFlags_dll PROPERTY LINK_FLAGS ${pre}BADFLAG${obj})
+add_library(LinkFlags_mod MODULE LinkFlagsLib.c)
+set_property(TARGET LinkFlags_mod PROPERTY LINK_FLAGS ${pre}BADFLAG${obj})
+
add_executable(LinkFlags_exe LinkFlagsExe.c)
set_property(TARGET LinkFlags_exe PROPERTY LINK_FLAGS ${pre}BADFLAG${obj})
@@ -22,7 +25,13 @@ set_property(TARGET LinkFlags_lib_config PROPERTY STATIC_LIBRARY_FLAGS_${TEST_CO
add_library(LinkFlags_dll_config SHARED LinkFlagsLib.c)
set_property(TARGET LinkFlags_dll_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
+add_library(LinkFlags_mod_config MODULE LinkFlagsLib.c)
+set_property(TARGET LinkFlags_mod_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
+
add_executable(LinkFlags_exe_config LinkFlagsExe.c)
set_property(TARGET LinkFlags_exe_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj})
add_executable(LinkFlags LinkFlags.c)
+
+add_subdirectory(LinkerFlags)
+add_subdirectory(LinkerFlagsConfig)
diff --git a/Tests/LinkFlags/LinkerFlags/CMakeLists.txt b/Tests/LinkFlags/LinkerFlags/CMakeLists.txt
new file mode 100644
index 0000000..4707f47
--- /dev/null
+++ b/Tests/LinkFlags/LinkerFlags/CMakeLists.txt
@@ -0,0 +1,11 @@
+set(CMAKE_STATIC_LINKER_FLAGS ${pre}BADFLAG${obj})
+add_library(LinkFlags_lib_flags STATIC ../LinkFlagsLib.c)
+
+set(CMAKE_SHARED_LINKER_FLAGS ${pre}BADFLAG${obj})
+add_library(LinkFlags_dll_flags SHARED ../LinkFlagsLib.c)
+
+set(CMAKE_MODULE_LINKER_FLAGS ${pre}BADFLAG${obj})
+add_library(LinkFlags_mod_flags MODULE ../LinkFlagsLib.c)
+
+set(CMAKE_EXE_LINKER_FLAGS ${pre}BADFLAG${obj})
+add_executable(LinkFlags_exe_flags ../LinkFlagsExe.c)
diff --git a/Tests/LinkFlags/LinkerFlagsConfig/CMakeLists.txt b/Tests/LinkFlags/LinkerFlagsConfig/CMakeLists.txt
new file mode 100644
index 0000000..2854fe7
--- /dev/null
+++ b/Tests/LinkFlags/LinkerFlagsConfig/CMakeLists.txt
@@ -0,0 +1,11 @@
+set(CMAKE_STATIC_LINKER_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG${obj})
+add_library(LinkFlags_lib_flags_config STATIC ../LinkFlagsLib.c)
+
+set(CMAKE_SHARED_LINKER_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG${obj})
+add_library(LinkFlags_dll_flags_config SHARED ../LinkFlagsLib.c)
+
+set(CMAKE_MODULE_LINKER_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG${obj})
+add_library(LinkFlags_mod_flags_config MODULE ../LinkFlagsLib.c)
+
+set(CMAKE_EXE_LINKER_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG${obj})
+add_executable(LinkFlags_exe_flags_config ../LinkFlagsExe.c)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd588112b262bf06344b9d6ecf4e5a626a1cec38
commit bd588112b262bf06344b9d6ecf4e5a626a1cec38
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Thu Jul 11 10:21:08 2013 +0200
Commit: Patrick Gansterer <paroga at paroga.com>
CommitDate: Sun Jul 28 20:39:03 2013 +0200
Add documentation for the missing CMAKE_*_LINKER_FLAGS_* variables
Add CMAKE_MODULE_LINKER_FLAGS_*, CMAKE_SHARED_LINKER_FLAGS_* and
CMAKE_STATIC_LINKER_FLAGS_* to cmDocumentVariables.cxx with a
similar documentation as CMAKE_EXE_LINKER_FLAGS_*.
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index cfd5e76..5877f58 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1426,6 +1426,49 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Same as CMAKE_C_FLAGS_* but used by the linker "
"when creating executables.",false,
"Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_MODULE_LINKER_FLAGS", cmProperty::VARIABLE,
+ "Linker flags to be used to create modules.",
+ "These flags will be used by the linker when creating a module."
+ ,false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_MODULE_LINKER_FLAGS_<CONFIG>", cmProperty::VARIABLE,
+ "Flags to be used when linking a module.",
+ "Same as CMAKE_C_FLAGS_* but used by the linker "
+ "when creating modules.",false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_SHARED_LINKER_FLAGS", cmProperty::VARIABLE,
+ "Linker flags to be used to create shared libraries.",
+ "These flags will be used by the linker when creating a shared library."
+ ,false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_SHARED_LINKER_FLAGS_<CONFIG>", cmProperty::VARIABLE,
+ "Flags to be used when linking a shared library.",
+ "Same as CMAKE_C_FLAGS_* but used by the linker "
+ "when creating shared libraries.",false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_STATIC_LINKER_FLAGS", cmProperty::VARIABLE,
+ "Linker flags to be used to create static libraries.",
+ "These flags will be used by the linker when creating a static library."
+ ,false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
+ ("CMAKE_STATIC_LINKER_FLAGS_<CONFIG>", cmProperty::VARIABLE,
+ "Flags to be used when linking a static library.",
+ "Same as CMAKE_C_FLAGS_* but used by the linker "
+ "when creating static libraries.",false,
+ "Variables that Control the Build");
+
cm->DefineProperty
("CMAKE_LIBRARY_PATH_FLAG", cmProperty::VARIABLE,
"The flag to be used to add a library search path to a compiler.",
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dcc753d71fddd679e5d776936a8ce234eaee4098
commit dcc753d71fddd679e5d776936a8ce234eaee4098
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Thu Jul 11 10:18:56 2013 +0200
Commit: Patrick Gansterer <paroga at paroga.com>
CommitDate: Sun Jul 28 20:39:02 2013 +0200
Add CMAKE_STATIC_LINKER_FLAGS to CMakeCommonLanguageInclude
Add support for CMAKE_STATIC_LINKER_FLAGS_* to
CMakeCommonLanguageInclude.cmake to set the defaults similar
to the other CMAKE_*_LINKER_FLAGS_*.
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index bf94f9f..e945aa7 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -68,6 +68,19 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
"Flags used by the linker during Release with Debug Info builds.")
+ set (CMAKE_STATIC_LINKER_FLAGS_DEBUG ${CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT} CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+ set (CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL ${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL_INIT}
+ CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+ set (CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT} CACHE STRING
+ "Flags used by the linker during release builds.")
+
+ set (CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
+ ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
endif()
# shared linker flags
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
@@ -77,6 +90,10 @@ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
CACHE STRING "Flags used by the linker during the creation of modules.")
+# static linker flags
+set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS_INIT}"
+ CACHE STRING "Flags used by the linker during the creation of static libraries.")
+
set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
"What is the target build tool cmake is generating for.")
@@ -103,5 +120,10 @@ CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_STATIC_LINKER_FLAGS
+CMAKE_STATIC_LINKER_FLAGS_DEBUG
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
+CMAKE_STATIC_LINKER_FLAGS_RELEASE
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23957a870e4a4a3f84578eab87503b922c6036d0
commit 23957a870e4a4a3f84578eab87503b922c6036d0
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Sun Apr 7 17:39:05 2013 +0200
Commit: Patrick Gansterer <paroga at paroga.com>
CommitDate: Sun Jul 28 20:39:02 2013 +0200
Add support for CMAKE_STATIC_LINKER_FLAGS
Add the content of this variable to the target specific linker flags
as we do with the other CMAKE_*_LINKER_FLAGS variables already.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 75ff7b3..b515727 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1545,6 +1545,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& config,
cmTarget* target)
{
+ this->AppendFlags(flags,
+ this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
+ if(!config.empty())
+ {
+ std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
+ this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name.c_str()));
+ }
this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
if(!config.empty())
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index df6e1f1..5ca8aba 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1435,38 +1435,39 @@ void cmLocalVisualStudio6Generator
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;
- }
+ const char *libflagsGlobal =
+ this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS");
+ this->AppendFlags(staticLibOptions, libflagsGlobal);
+ this->AppendFlags(staticLibOptionsDebug, libflagsGlobal);
+ this->AppendFlags(staticLibOptionsRelease, libflagsGlobal);
+ this->AppendFlags(staticLibOptionsMinSizeRel, libflagsGlobal);
+ this->AppendFlags(staticLibOptionsRelWithDebInfo, libflagsGlobal);
+
+ this->AppendFlags(staticLibOptionsDebug, this->Makefile->
+ GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_DEBUG"));
+ this->AppendFlags(staticLibOptionsRelease, this->Makefile->
+ GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELEASE"));
+ this->AppendFlags(staticLibOptionsMinSizeRel, this->Makefile->
+ GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL"));
+ this->AppendFlags(staticLibOptionsRelWithDebInfo, this->Makefile->
+ GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO"));
+
+ const char *libflags = target.GetProperty("STATIC_LIBRARY_FLAGS");
+ this->AppendFlags(staticLibOptions, libflags);
+ this->AppendFlags(staticLibOptionsDebug, libflags);
+ this->AppendFlags(staticLibOptionsRelease, libflags);
+ this->AppendFlags(staticLibOptionsMinSizeRel, libflags);
+ this->AppendFlags(staticLibOptionsRelWithDebInfo, libflags);
+
+ this->AppendFlags(staticLibOptionsDebug,
+ target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG"));
+ this->AppendFlags(staticLibOptionsRelease,
+ target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE"));
+ this->AppendFlags(staticLibOptionsMinSizeRel,
+ target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL"));
+ this->AppendFlags(staticLibOptionsRelWithDebInfo,
+ target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO"));
+
std::string objects;
this->OutputObjects(target, "LIB", objects);
if(!objects.empty())
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1081f551856b3d2619c9901b9641eb28f0854e1
commit f1081f551856b3d2619c9901b9641eb28f0854e1
Author: Patrick Gansterer <paroga at paroga.com>
AuthorDate: Wed Jul 10 19:11:04 2013 +0200
Commit: Patrick Gansterer <paroga at paroga.com>
CommitDate: Sun Jul 28 20:39:02 2013 +0200
Unify the way the flags of a static library are read
Introduce cmLocalGenerator::GetStaticLibraryFlags() to have a central
function for getting the linker flags for a given target.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 63de1a5..59dfea4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1769,27 +1769,29 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
configName);
}
- const char* linkFlagsProp = "LINK_FLAGS";
if(target.GetType() == cmTarget::OBJECT_LIBRARY ||
target.GetType() == cmTarget::STATIC_LIBRARY)
{
- linkFlagsProp = "STATIC_LIBRARY_FLAGS";
- }
- const char* targetLinkFlags = target.GetProperty(linkFlagsProp);
- if(targetLinkFlags)
- {
- extraLinkOptions += " ";
- extraLinkOptions += targetLinkFlags;
+ this->CurrentLocalGenerator
+ ->GetStaticLibraryFlags(extraLinkOptions, configName, &target);
}
- if(configName && *configName)
+ else
{
- std::string linkFlagsVar = linkFlagsProp;
- linkFlagsVar += "_";
- linkFlagsVar += cmSystemTools::UpperCase(configName);
- if(const char* linkFlags = target.GetProperty(linkFlagsVar.c_str()))
+ const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
+ if(targetLinkFlags)
{
- extraLinkOptions += " ";
- extraLinkOptions += linkFlags;
+ this->CurrentLocalGenerator->
+ AppendFlags(extraLinkOptions, targetLinkFlags);
+ }
+ if(configName && *configName)
+ {
+ std::string linkFlagsVar = "LINK_FLAGS_";
+ linkFlagsVar += cmSystemTools::UpperCase(configName);
+ if(const char* linkFlags = target.GetProperty(linkFlagsVar.c_str()))
+ {
+ this->CurrentLocalGenerator->
+ AppendFlags(extraLinkOptions, linkFlags);
+ }
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b187d6b..75ff7b3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1541,6 +1541,18 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
}
+void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
+ std::string const& config,
+ cmTarget* target)
+{
+ this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
+ if(!config.empty())
+ {
+ std::string name = "STATIC_LIBRARY_FLAGS_" + config;
+ this->AppendFlags(flags, target->GetProperty(name.c_str()));
+ }
+}
+
void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
std::string& flags,
std::string& linkFlags,
@@ -1557,26 +1569,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
switch(target->GetType())
{
case cmTarget::STATIC_LIBRARY:
- {
- const char* targetLinkFlags =
- target->GetProperty("STATIC_LIBRARY_FLAGS");
- if(targetLinkFlags)
- {
- linkFlags += targetLinkFlags;
- linkFlags += " ";
- }
- if(!buildType.empty())
- {
- std::string build = "STATIC_LIBRARY_FLAGS_";
- build += buildType;
- targetLinkFlags = target->GetProperty(build.c_str());
- if(targetLinkFlags)
- {
- linkFlags += targetLinkFlags;
- linkFlags += " ";
- }
- }
- }
+ this->GetStaticLibraryFlags(linkFlags, buildType, target->Target);
break;
case cmTarget::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index ed0f6e3..10f0b1a 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -348,6 +348,11 @@ public:
std::string const& dir_max,
bool* hasSourceExtension = 0);
+ /** Fill out the static linker flags for the given target. */
+ void GetStaticLibraryFlags(std::string& flags,
+ std::string const& config,
+ cmTarget* target);
+
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
void GetTargetFlags(std::string& linkLibs,
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9ecd53d..672edf4 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1039,17 +1039,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
}
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;
- }
+ this->GetStaticLibraryFlags(libflags, configTypeUpper, &target);
if(!libflags.empty())
{
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 347f26d..ea9663f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -144,12 +144,8 @@ 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->LocalGenerator->GetStaticLibraryFlags(extraFlags,
+ cmSystemTools::UpperCase(this->ConfigName), this->Target);
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d59de11..da5696a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1417,20 +1417,17 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
{
return;
}
- 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)
+ std::string libflags;
+ this->LocalGenerator->GetStaticLibraryFlags(libflags,
+ cmSystemTools::UpperCase(config), this->Target);
+ if(!libflags.empty())
{
this->WriteString("<Lib>\n", 2);
cmVisualStudioGeneratorOptions
libOptions(this->LocalGenerator,
cmVisualStudioGeneratorOptions::Linker,
cmVSGetLibFlagTable(this->LocalGenerator), 0, this);
- libOptions.Parse(libflags?libflags:"");
- libOptions.Parse(libflagsConfig?libflagsConfig:"");
+ libOptions.Parse(libflags.c_str());
libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
libOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Lib>\n", 2);
-----------------------------------------------------------------------
Summary of changes:
Modules/CMakeCommonLanguageInclude.cmake | 22 +++++++
Source/cmDocumentVariables.cxx | 43 ++++++++++++++
Source/cmGlobalXCodeGenerator.cxx | 32 ++++++-----
Source/cmLocalGenerator.cxx | 40 +++++++-------
Source/cmLocalGenerator.h | 5 ++
Source/cmLocalVisualStudio6Generator.cxx | 65 +++++++++++-----------
Source/cmLocalVisualStudio7Generator.cxx | 12 +----
Source/cmMakefileLibraryTargetGenerator.cxx | 8 +--
Source/cmVisualStudio10TargetGenerator.cxx | 13 ++---
Tests/CMakeLists.txt | 14 ++++-
Tests/LinkFlags/CMakeLists.txt | 9 +++
Tests/LinkFlags/LinkerFlags/CMakeLists.txt | 11 ++++
Tests/LinkFlags/LinkerFlagsConfig/CMakeLists.txt | 11 ++++
13 files changed, 191 insertions(+), 94 deletions(-)
create mode 100644 Tests/LinkFlags/LinkerFlags/CMakeLists.txt
create mode 100644 Tests/LinkFlags/LinkerFlagsConfig/CMakeLists.txt
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list