summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-11-11 23:10:30 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-11-11 23:10:30 (GMT)
commit36db45082e49ac9a6f44c156d8706e1fef65627a (patch)
tree5c4c69e96a8c82d82dfe09680ac9fbeb5501c627 /Source
parent928b9dee0693371c1bcf6101a2a363a983615403 (diff)
downloadCMake-36db45082e49ac9a6f44c156d8706e1fef65627a.zip
CMake-36db45082e49ac9a6f44c156d8706e1fef65627a.tar.gz
CMake-36db45082e49ac9a6f44c156d8706e1fef65627a.tar.bz2
ENH: fix up several problems with new stuff
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt5
-rw-r--r--Source/TODO55
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx76
-rw-r--r--Source/cmLocalUnixMakefileGenerator.h6
4 files changed, 126 insertions, 16 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index a25f1d7..8e3bfa5 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -135,6 +135,11 @@ IF(BUILD_TESTING)
ADD_TEST(DumpDocumentation ${CMake_BINARY_DIR}/Source/DumpDocumentation
${CMake_BINARY_DIR}/CMakeDoc.html)
+ ADD_TEST(SystemInformation ${CMake_BINARY_DIR}/Source/cmaketest
+ ${CMake_SOURCE_DIR}/Tests/SystemInformation
+ ${CMake_BINARY_DIR}/Tests/SystemInformation
+ DumpInformation)
+
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
${CMake_SOURCE_DIR}/Tests/Simple
${CMake_BINARY_DIR}/Tests/Simple
diff --git a/Source/TODO b/Source/TODO
index ce0fbbd..ff3a417 100644
--- a/Source/TODO
+++ b/Source/TODO
@@ -1,4 +1,9 @@
link flags
+.def file in link shared
+
+
+CMAKE_CXX_FLAGS are used to link executables
+
Variables:
@@ -52,3 +57,53 @@ CMAKE_X_LIBS
CMAKE_X_CFLAGS
CMAKE_HAS_X
+# executable linker flags
+
+SET (CMAKE_EXE_LINKER_FLAGS "/nologo /STACK:10000000 /machine:I386 /INCREMENTAL:YES"
+ CACHE STRING "Flags used by the linker.")
+
+SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+SET (CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING
+ "Flags used by the linker during release builds.")
+
+SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+# shared linker flags
+
+SET (CMAKE_SHARED_LINKER_FLAGS "/nologo /STACK:10000000 /machine:I386 /INCREMENTAL:YES"
+ CACHE STRING "Flags used by the linker.")
+
+SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+SET (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+SET (CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE STRING
+ "Flags used by the linker during release builds.")
+
+SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+
+# module linker flags
+SET (CMAKE_MODULE_LINKER_FLAGS "/nologo /STACK:10000000 /machine:I386 /INCREMENTAL:YES"
+ CACHE STRING "Flags used by the linker.")
+
+SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during debug builds.")
+
+SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE "" CACHE STRING
+ "Flags used by the linker during release builds.")
+
+SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index cb707c4..5eb60dc 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -558,10 +558,9 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
runtimeDirs.push_back( libpath );
}
}
- cmRegularExpression reg(regexp.c_str());
+ cmRegularExpression reg(regexp.c_str());
cmRegularExpression libname("lib([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
cmRegularExpression libname_noprefix("([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*");
-
if(libname.find(file))
{
librariesLinked += libLinkFlag;
@@ -696,8 +695,13 @@ cmLocalUnixMakefileGenerator::ExpandRuleVariables(std::string& s,
const char* object,
const char* flags,
const char* objectsquoted,
- const char* targetBase)
+ const char* targetBase,
+ const char* linkFlags)
{
+ if(linkFlags)
+ {
+ cmSystemTools::ReplaceString(s, "<LINK_FLAGS>", linkFlags);
+ }
if(flags)
{
cmSystemTools::ReplaceString(s, "<FLAGS>", flags);
@@ -748,7 +752,8 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
const char* prefix,
const char* suffix,
const char* createVariable,
- const char* comment
+ const char* comment,
+ const char* linkFlags
)
{
// create the library name
@@ -796,7 +801,8 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
targetFullPath.c_str(),
linklibs.str().c_str(),
0, 0, 0, objsQuoted.c_str(),
- targetBaseFullPath.c_str());
+ targetBaseFullPath.c_str(),
+ linkFlags);
}
this->OutputMakeRule(fout, comment,
targetFullPath.c_str(),
@@ -817,11 +823,24 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
{
createRule = "CMAKE_C_CREATE_SHARED_LIBRARY";
}
+ std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
+ std::string linkFlags = this->GetSafeDefinition("CMAKE_SHARED_LINKER_FLAGS");
+ linkFlags += " ";
+ if(buildType.size())
+ {
+ std::string build = "CMAKE_SHARED_LINKER_FLAGS_";
+ build += buildType;
+ linkFlags += this->GetSafeDefinition(build.c_str());
+ linkFlags += " ";
+ }
+
this->OutputLibraryRule(fout, name, t,
this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_PREFIX"),
this->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"),
createRule,
- "shared library");
+ "shared library",
+ linkFlags.c_str());
}
void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
@@ -837,11 +856,23 @@ void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
{
createRule = "CMAKE_C_CREATE_SHARED_MODULE";
}
+ std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
+ std::string linkFlags = this->GetSafeDefinition("CMAKE_MODULE_LINKER_FLAGS");
+ linkFlags += " ";
+ if(buildType.size())
+ {
+ std::string build = "CMAKE_MODULE_LINKER_FLAGS_";
+ build += buildType;
+ linkFlags += this->GetSafeDefinition(build.c_str());
+ linkFlags += " ";
+ }
this->OutputLibraryRule(fout, name, t,
this->GetSafeDefinition("CMAKE_SHARED_MODULE_PREFIX"),
this->GetSafeDefinition("CMAKE_SHARED_MODULE_SUFFIX"),
createRule,
- "shared module");
+ "shared module",
+ linkFlags.c_str());
}
@@ -862,14 +893,18 @@ void cmLocalUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX"),
this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"),
createRule,
- "static library");
+ "static library", 0);
}
void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
- const char* name,
- const cmTarget &t)
+ const char* name,
+ const cmTarget &t)
{
+ std::string linkFlags;
+
+ std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
std::string flags;
std::string target = m_ExecutableOutputPath + name
+ cmSystemTools::GetExecutableExtension();
@@ -878,6 +913,15 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
depend += this->CreateMakeVariable(name, "_SRC_OBJS")
+ ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
std::vector<std::string> rules;
+ linkFlags += this->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
+ linkFlags += " ";
+ if(buildType.size())
+ {
+ std::string build = "CMAKE_EXE_LINKER_FLAGS_";
+ build += buildType;
+ linkFlags += this->GetSafeDefinition(build.c_str());
+ linkFlags += " ";
+ }
if(t.HasCxx())
{
rules.push_back(m_Makefile->GetDefinition("CMAKE_CXX_LINK_EXECUTABLE"));
@@ -901,7 +945,6 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
{
commands.push_back(customCommands.c_str());
}
- std::string linkFlags;
if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
{
linkFlags += this->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE");
@@ -912,16 +955,21 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
linkFlags += this->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
linkFlags += " ";
}
+
for(std::vector<std::string>::iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmSystemTools::ReplaceString(*i, "<LINK_FLAGS>", linkFlags.c_str());
this->ExpandRuleVariables(*i,
objs.c_str(),
target.c_str(),
linklibs.str().c_str(),
- 0, 0, flags.c_str());
+ 0,
+ 0,
+ flags.c_str(),
+ 0,
+ 0,
+ linkFlags.c_str());
}
this->OutputMakeRule(fout,
comment.c_str(),
@@ -2169,7 +2217,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
0, // no link libs
sourceFile.c_str(),
objectFile.c_str(),
- flags.c_str() );
+ flags.c_str());
}
this->OutputMakeRule(fout,
comment.c_str(),
diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h
index c441ace..70a43d6 100644
--- a/Source/cmLocalUnixMakefileGenerator.h
+++ b/Source/cmLocalUnixMakefileGenerator.h
@@ -88,7 +88,8 @@ protected:
const char* prefix,
const char* suffix,
const char* createRule,
- const char* comment
+ const char* comment,
+ const char* linkFlags
);
void ExpandRuleVariables(std::string& string,
const char* objects=0,
@@ -98,7 +99,8 @@ protected:
const char* object =0,
const char* flags = 0,
const char* objectsquoted = 0,
- const char* targetBase = 0);
+ const char* targetBase = 0,
+ const char* linkFlags = 0);
virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputModuleLibraryRule(std::ostream&, const char* name,