summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx17
-rw-r--r--Templates/CMakeNMakeWindowsSystemConfig.cmake18
2 files changed, 30 insertions, 5 deletions
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index 26a48c2..886baf9 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -156,7 +156,7 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"CMAKE_LINKER = @CMAKE_LINKER@\n"
"CMAKE_C_LINK_EXECUTABLE_FLAG = @CMAKE_C_LINK_EXECUTABLE_FLAG@\n"
"CMAKE_C_LIBPATH_FLAG = @CMAKE_C_LIBPATH_FLAG@\n"
- "CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@\n"
+ "CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n"
"CMAKE_LINKER_SHARED_LIBRARY_FLAG = @CMAKE_LINKER_SHARED_LIBRARY_FLAG@\n"
"CMAKE_LINKER_STATIC_LIBRARY_FLAG = @CMAKE_LINKER_STATIC_LIBRARY_FLAG@\n"
"CMAKE_LINKER_OUTPUT_FILE_FLAG = @CMAKE_LINKER_OUTPUT_FILE_FLAG@\n"
@@ -166,12 +166,21 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"CMAKE_EXECUTABLE_SUFFIX = @CMAKE_EXECUTABLE_SUFFIX@\n"
"CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n"
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n";
+
std::string buildType = "CMAKE_CXX_FLAGS_";
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
buildType = cmSystemTools::UpperCase(buildType);
m_Makefile->AddDefinition("BUILD_FLAGS",
m_Makefile->GetDefinition(
buildType.c_str()));
+
+ buildType = "CMAKE_LINKER_FLAGS_";
+ buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ buildType = cmSystemTools::UpperCase(buildType);
+ m_Makefile->AddDefinition("LINKER_BUILD_FLAGS",
+ m_Makefile->GetDefinition(
+ buildType.c_str()));
+
std::string replaceVars = variables;
m_Makefile->ExpandVariablesInString(replaceVars);
fout << replaceVars.c_str();
@@ -387,8 +396,8 @@ void cmNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
std::string depend = "$(";
depend += name;
depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
- std::string command = "$(CMAKE_LINKER) $(CMAKE_LINKER_SHARED_LIBRARY_FLAG) @<<\n";
- command += "$(" + std::string(name) + "_SRC_OBJS) $(CMAKE_LINKER_OUTPUT_FILE_FLAG)";
+ std::string command = "$(CMAKE_LINKER) $(CMAKE_LINKER_SHARED_LIBRARY_FLAG) $(CMAKE_LINKER_FLAGS) @<<\n\t";
+ command += " $(" + std::string(name) + "_SRC_OBJS) $(CMAKE_LINKER_OUTPUT_FILE_FLAG)";
std::string dllpath = m_LibraryOutputPath + std::string(name) + m_SharedLibraryExtension;
command += cmSystemTools::EscapeSpaces(dllpath.c_str());
command += " ";
@@ -429,7 +438,7 @@ void cmNMakeMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
std::string target = m_LibraryOutputPath + std::string(name) + m_StaticLibraryExtension;
std::string depend = "$(";
depend += std::string(name) + "_SRC_OBJS)";
- std::string command = "$(CMAKE_LINKER) $(CMAKE_LINKER_STATIC_LIBRARY_FLAG) @<<\n\t$(CMAKE_LINKER_FLAGS) $(CMAKE_LINKER_OUTPUT_FILE_FLAG)";
+ std::string command = "$(CMAKE_LINKER) $(CMAKE_LINKER_STATIC_LIBRARY_FLAG) $(CMAKE_LINKER_FLAGS) @<<\n\t $(CMAKE_LINKER_OUTPUT_FILE_FLAG)";
std::string libpath = m_LibraryOutputPath + std::string(name) + m_StaticLibraryExtension;
command += cmSystemTools::EscapeSpaces(libpath.c_str());
command += " $(";
diff --git a/Templates/CMakeNMakeWindowsSystemConfig.cmake b/Templates/CMakeNMakeWindowsSystemConfig.cmake
index 8975a2a..db62b32 100644
--- a/Templates/CMakeNMakeWindowsSystemConfig.cmake
+++ b/Templates/CMakeNMakeWindowsSystemConfig.cmake
@@ -30,9 +30,21 @@ SET (CMAKE_C_LIBPATH_FLAG "-LIBPATH:" CACHE STRING
SET (CMAKE_LINKER link CACHE FILEPATH
"Name of linker used.")
-SET (CMAKE_LINKER_FLAGS "/nologo" CACHE STRING
+SET (CMAKE_LINKER_FLAGS "/nologo /STACK:10000000 /machine:I386" CACHE STRING
"Flags used by the linker.")
+SET (CMAKE_LINKER_FLAGS_RELEASE "" CACHE STRING
+ "Flags used by the linker during release builds.")
+
+SET (CMAKE_LINKER_FLAGS_RELWITHDEBINFO "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during Release with Debug Info builds.")
+
+SET (CMAKE_LINKER_FLAGS_MINSIZEREL "/stack:0x989680" CACHE STRING
+ "Flags used by the linker during release minsize builds.")
+
+SET (CMAKE_LINKER_FLAGS_DEBUG "/debug /pdbtype:sept" CACHE STRING
+ "Flags used by the linker during debug builds.")
+
SET (CMAKE_LINKER_SHARED_LIBRARY_FLAG "/dll" CACHE STRING
"Flags used to create a shared library.")
@@ -101,6 +113,10 @@ CMAKE_C_LINK_EXECUTABLE_FLAG
CMAKE_C_LIBPATH_FLAG
CMAKE_LINKER
CMAKE_LINKER_FLAGS
+CMAKE_LINKER_FLAGS_RELEASE
+CMAKE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_LINKER_FLAGS_MINSIZEREL
+CMAKE_LINKER_FLAGS_DEBUG
CMAKE_LINKER_SHARED_LIBRARY_FLAG
CMAKE_LINKER_STATIC_LIBRARY_FLAG
CMAKE_LINKER_OUTPUT_FILE_FLAG