summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-04-19 20:36:14 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-04-19 20:36:14 (GMT)
commite6ef33f598f7ff74f7b6d7c60f98f883937c385a (patch)
tree860d6cfcf80922a545e02dc8e8b3e89076bbf137
parentf2e2f23392816ba826ebdd0e91851fc0e1aeaed1 (diff)
downloadCMake-e6ef33f598f7ff74f7b6d7c60f98f883937c385a.zip
CMake-e6ef33f598f7ff74f7b6d7c60f98f883937c385a.tar.gz
CMake-e6ef33f598f7ff74f7b6d7c60f98f883937c385a.tar.bz2
ENH: name pdb files for visual studio make based builds
-rw-r--r--Modules/Platform/Windows-cl.cmake10
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmLocalGenerator.h1
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx18
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
6 files changed, 39 insertions, 11 deletions
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 13c1aee..5da4721 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -14,7 +14,7 @@ ELSE(CMAKE_VERBOSE_MAKEFILE)
ENDIF(CMAKE_VERBOSE_MAKEFILE)
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
- "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /PDB:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library
@@ -31,18 +31,18 @@ SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
# compile a C++ file into an object file
SET(CMAKE_CXX_COMPILE_OBJECT
- "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /Fo<OBJECT> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
# compile a C file into an object file
SET(CMAKE_C_COMPILE_OBJECT
- "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /Fo<OBJECT> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
SET(CMAKE_C_LINK_EXECUTABLE
- "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> /Fd<TARGET_PDB> -link <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_LINK_EXECUTABLE
- "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> /Fd<TARGET_PDB> -link <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 765e720..6ada0d9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -734,6 +734,14 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.ObjectsQuoted;
}
}
+ if(replaceValues.TargetPDB )
+ {
+ if(variable == "TARGET_PDB")
+ {
+ return replaceValues.TargetPDB;
+ }
+ }
+
if(replaceValues.Target)
{
if(variable == "TARGET_QUOTED")
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 4db28f5..ccc9bef 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -192,6 +192,7 @@ public:
this->TargetInstallNameDir = 0;
this->LinkFlags= 0;
}
+ const char* TargetPDB;
const char* Language;
const char* Objects;
const char* Target;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 37c664c..d35acfd 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -168,17 +168,22 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
std::string targetFullPath = outpath + targetName;
std::string targetFullPathReal = outpath + targetNameReal;
-
+ std::string targetFullPathPDB = outpath + this->Target->GetName();
+ targetFullPathPDB += ".pdb";
+ std::string targetOutPathPDB =
+ this->Convert(targetFullPathPDB.c_str(),
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::MAKEFILE);
// Convert to the output path to use in constructing commands.
std::string targetOutPath =
this->Convert(targetFullPath.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::MAKEFILE);
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::MAKEFILE);
std::string targetOutPathReal =
this->Convert(targetFullPathReal.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::MAKEFILE);
-
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::MAKEFILE);
+
// Get the language to use for linking this executable.
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->GlobalGenerator);
@@ -328,6 +333,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str();
vars.Target = targetOutPathReal.c_str();
+ vars.TargetPDB = targetOutPathPDB.c_str();
std::string linkString = linklibs.str();
vars.LinkLibraries = linkString.c_str();
vars.Flags = flags.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 9140d31..fac4513 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -233,12 +233,16 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
outpath += "/";
}
std::string targetFullPath = outpath + targetName;
+ std::string targetFullPathPDB = outpath + this->Target->GetName() + std::string(".pdb");
std::string targetFullPathSO = outpath + targetNameSO;
std::string targetFullPathReal = outpath + targetNameReal;
std::string targetFullPathImport = outpath + targetNameImport;
// Construct the output path version of the names for use in command
// arguments.
+ std::string targetOutPathPDB =
+ this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::FULL,
+ cmLocalGenerator::MAKEFILE);
std::string targetOutPath =
this->Convert(targetFullPath.c_str(),cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::MAKEFILE);
@@ -402,6 +406,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cleanObjs += variableName;
cleanObjs += ")";
cmLocalGenerator::RuleVariables vars;
+ vars.TargetPDB = targetOutPathPDB.c_str();
vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str();
std::string objdir = "CMakeFiles/";
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index aca3d29..f114b73 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -385,8 +385,16 @@ cmMakefileTargetGenerator
std::string compileRule =
this->Makefile->GetRequiredDefinition(compileRuleVar.c_str());
cmSystemTools::ExpandListArgument(compileRule, commands);
+
+ std::string outpath = this->Makefile->GetStartOutputDirectory();
+ outpath += "/";
+ outpath += this->Target->GetName();
+ outpath += ".pdb";
+ outpath = this->Convert(outpath.c_str(), cmLocalGenerator::FULL,
+ cmLocalGenerator::MAKEFILE);
cmLocalGenerator::RuleVariables vars;
vars.Language = lang;
+ vars.TargetPDB = outpath.c_str();
vars.Source = sourceFile.c_str();
vars.Object = relativeObj.c_str();
std::string objdir = this->LocalGenerator->GetHomeRelativeOutputPath();