diff options
author | Brad King <brad.king@kitware.com> | 2006-04-18 15:45:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-04-18 15:45:31 (GMT) |
commit | 428b4c92440091d798b0d6bcbae6544a168ca867 (patch) | |
tree | 04e1d5f2dcd82fb911208f71ab69ce21d4d53dd5 | |
parent | 392137b6d7e53ee6e7187b530522f772137bcd6c (diff) | |
download | CMake-428b4c92440091d798b0d6bcbae6544a168ca867.zip CMake-428b4c92440091d798b0d6bcbae6544a168ca867.tar.gz CMake-428b4c92440091d798b0d6bcbae6544a168ca867.tar.bz2 |
ENH: Updated VS6 generator to use target.GetFullName() to compute target file names.
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 47 | ||||
-rw-r--r-- | Templates/DLLHeader.dsptemplate | 8 | ||||
-rw-r--r-- | Templates/EXEHeader.dsptemplate | 8 | ||||
-rw-r--r-- | Templates/EXEWinHeader.dsptemplate | 4 | ||||
-rw-r--r-- | Templates/staticLibHeader.dsptemplate | 8 | ||||
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/CMakeLists.txt | 5 |
7 files changed, 49 insertions, 36 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6fa2a9a..b1406d3 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -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", diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate index ae5e506..59cbeef 100644 --- a/Templates/DLLHeader.dsptemplate +++ b/Templates/DLLHeader.dsptemplate @@ -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
diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate index 0ee4091..203e8ec 100644 --- a/Templates/EXEHeader.dsptemplate +++ b/Templates/EXEHeader.dsptemplate @@ -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
diff --git a/Templates/EXEWinHeader.dsptemplate b/Templates/EXEWinHeader.dsptemplate index 880ad07..8a7f7e0 100644 --- a/Templates/EXEWinHeader.dsptemplate +++ b/Templates/EXEWinHeader.dsptemplate @@ -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
diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate index a84900b..b4d2570 100644 --- a/Templates/staticLibHeader.dsptemplate +++ b/Templates/staticLibHeader.dsptemplate @@ -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
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index ac8f12e..aa9dfe4 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -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) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index ac8f12e..aa9dfe4 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -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) |