ENH: Updated VS6 generator to use target.GetFullName() to compute target file names.

This commit is contained in:
Brad King 2006-04-18 11:45:31 -04:00
parent 392137b6d7
commit 428b4c9244
7 changed files with 49 additions and 36 deletions

View File

@ -1013,30 +1013,13 @@ void cmLocalVisualStudio6Generator
}
}
}
std::string outputName = "(OUTPUT_NAME is for executables only)";
// Get extra linker options for this target type.
std::string extraLinkOptions;
// TODO: Fix construction of library/executable name through
// cmTarget. OUTPUT_LIBNAMEDEBUG_POSTFIX should be replaced by the
// library's debug configuration name. OUTPUT_LIBNAME should be
// replaced by the non-debug configuration name. This generator
// should just be re-written to not use template files and just
// generate the code. Setting up these substitutions is a pain.
if(target.GetType() == cmTarget::EXECUTABLE)
{
extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
// Use the OUTPUT_NAME property if it was set. This is supported
// only for executables.
if(const char* outName = target.GetProperty("OUTPUT_NAME"))
{
outputName = outName;
}
else
{
outputName = target.GetName();
}
outputName += ".exe";
}
if(target.GetType() == cmTarget::SHARED_LIBRARY)
{
@ -1047,6 +1030,24 @@ void cmLocalVisualStudio6Generator
extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
}
// Compute the real name of the target.
std::string outputName = "(OUTPUT_NAME is for libraries and executables only)";
std::string outputNameDebug = outputName;
std::string outputNameRelease = outputName;
std::string outputNameMinSizeRel = outputName;
std::string outputNameRelWithDebInfo = outputName;
if(target.GetType() == cmTarget::EXECUTABLE ||
target.GetType() == cmTarget::STATIC_LIBRARY ||
target.GetType() == cmTarget::SHARED_LIBRARY ||
target.GetType() == cmTarget::MODULE_LIBRARY)
{
outputName = target.GetFullName();
outputNameDebug = target.GetFullName("Debug");
outputNameRelease = target.GetFullName("Release");
outputNameMinSizeRel = target.GetFullName("MinSizeRel");
outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo");
}
if(extraLinkOptions.size())
{
libOptions += " ";
@ -1174,9 +1175,11 @@ void cmLocalVisualStudio6Generator
cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIMIZED_LIBRARIES",
libMultiLineOptimizedOptions.c_str());
// Replace the template file text OUTPUT_NAME with the real output
// name that will be used. Only the executable template should
// have this text.
// Substitute the real output name into the template.
cmSystemTools::ReplaceString(line, "OUTPUT_NAME_DEBUG", outputNameDebug.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", outputNameRelease.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", outputNameMinSizeRel.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", outputNameRelWithDebInfo.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_NAME", outputName.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",

View File

@ -71,7 +71,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /machine:I386
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /machine:I386 /out:"LIBRARY_OUTPUT_PATHRelease/OUTPUT_NAME_RELEASE"
CMAKE_CUSTOM_RULE_CODE
@ -104,7 +104,7 @@ LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES_FOR_DEBUG
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_LIBNAMEDEBUG_POSTFIX.dll" /pdbtype:sept
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_NAME_DEBUG" /pdbtype:sept
CMAKE_CUSTOM_RULE_CODE
@ -137,7 +137,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /machine:I386
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /machine:I386 /out:"LIBRARY_OUTPUT_PATHMinSizeRel/OUTPUT_NAME_MINSIZEREL"
CMAKE_CUSTOM_RULE_CODE
@ -168,7 +168,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386 /pdbtype:sept
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"LIBRARY_OUTPUT_PATHRelWithDebInfo/OUTPUT_NAME_RELWITHDEBINFO"
CMAKE_CUSTOM_RULE_CODE

View File

@ -69,7 +69,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelease\OUTPUT_NAME"
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelease\OUTPUT_NAME_RELEASE"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES
@ -102,7 +102,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHDebug\OUTPUT_NAME"
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHDebug\OUTPUT_NAME_DEBUG"
CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES_FOR_DEBUG
@ -132,7 +132,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHMinSizeRel\OUTPUT_NAME"
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHMinSizeRel\OUTPUT_NAME_MINSIZEREL"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES
@ -163,7 +163,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelWithDebInfo\OUTPUT_NAME"
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelWithDebInfo\OUTPUT_NAME_RELWITHDEBINFO"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES

View File

@ -71,6 +71,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:windows /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelease\OUTPUT_NAME_RELEASE"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES
@ -103,6 +104,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHDebug\OUTPUT_NAME_DEBUG"
CM_MULTILINE_DEBUG_LIBRARIES
CM_MULTILINE_LIBRARIES_FOR_DEBUG
@ -133,6 +135,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /nologo /subsystem:windows /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHMinSizeRel\OUTPUT_NAME_MINSIZEREL"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES
@ -165,6 +168,7 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 /IGNORE:4089
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /IGNORE:4089
# ADD LINK32 /out:"EXECUTABLE_OUTPUT_PATHRelWithDebInfo\OUTPUT_NAME_RELWITHDEBINFO"
CM_MULTILINE_OPTIMIZED_LIBRARIES
CM_MULTILINE_LIBRARIES

View File

@ -65,7 +65,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo CM_STATIC_LIB_ARGS
# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHRelease/OUTPUT_NAME_RELEASE" CM_STATIC_LIB_ARGS
CMAKE_CUSTOM_RULE_CODE
@ -93,7 +93,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo CM_STATIC_LIB_ARGS /out:"LIBRARY_OUTPUT_PATHDebug\OUTPUT_LIBNAMEDEBUG_POSTFIX.lib"
# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHDebug/OUTPUT_NAME_DEBUG" CM_STATIC_LIB_ARGS
CMAKE_CUSTOM_RULE_CODE
@ -122,7 +122,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo CM_STATIC_LIB_ARGS
# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHMinSizeRel/OUTPUT_NAME_MINSIZEREL" CM_STATIC_LIB_ARGS
CMAKE_CUSTOM_RULE_CODE
@ -150,7 +150,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo CM_STATIC_LIB_ARGS
# ADD LIB32 /nologo /out:"LIBRARY_OUTPUT_PATHRelWithDebInfo/OUTPUT_NAME_RELWITHDEBINFO" CM_STATIC_LIB_ARGS
CMAKE_CUSTOM_RULE_CODE

View File

@ -26,7 +26,7 @@ IF(STAGE2)
${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
${CMAKE_INSTALL_PREFIX}/MyTest/lib
)
SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX})
SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX})
@ -92,6 +92,9 @@ ELSE(STAGE2)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
# Test per-configuration output name.
SET_TARGET_PROPERTIES(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
IF(CMAKE_GENERATOR MATCHES "Makefiles")
ADD_SUBDIRECTORY(TestSubDir)
ADD_DEPENDENCIES(SimpleInstall TSD)

View File

@ -26,7 +26,7 @@ IF(STAGE2)
${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
${CMAKE_INSTALL_PREFIX}/MyTest/lib
)
SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX})
SET(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
SET(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
SET(t4NAMES test4 test4${CMAKE_DEBUG_POSTFIX})
@ -92,6 +92,9 @@ ELSE(STAGE2)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
# Test per-configuration output name.
SET_TARGET_PROPERTIES(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
IF(CMAKE_GENERATOR MATCHES "Makefiles")
ADD_SUBDIRECTORY(TestSubDir)
ADD_DEPENDENCIES(SimpleInstall TSD)