View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0000731 | CMake | CMake | public | 2004-04-02 08:53 | 2009-06-04 16:52 | ||||
Reporter | stefan.kowski | ||||||||
Assigned To | Ken Martin | ||||||||
Priority | normal | Severity | feature | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | CMake-2-6 | |||||||
Summary | 0000731: Setting target names depending on the build type - patch for Visual Studio 6 generator | ||||||||
Description | Using this patch, a new property can be set for a target to give it a different name for each build type. So even in Visual Studio different library names etc. can be easily defined. I think this patch solved a lot of reoccurring naming problems. CMakeLists.txt example: SET(TARGET_TESTLIB TestLib) ADD_LIBRARY(${TARGET_TESTLIB} source/TestLib.cpp) SET_TARGET_PROPERTIES(${TARGET_TESTLIB} PROPERTIES NAME_Debug TestLibsd.lib) SET_TARGET_PROPERTIES(${TARGET_TESTLIB} PROPERTIES NAME_Release TestLibs.lib) The property name is NAME_<Build-Type=Debug|Release|RelWithDebInfo|MinSizeRel> The Visual Studio 6 generator will check this target properties and modify the .dsp file accordingly. I would be glad if you can integrate this into a next release of CMake, and test it for Visual Studio 7/2003 etc. (I do not have this versions available). In the file staticLibHeader.dsptemplate, there is a line missing for the Debug target (you can see it in the diff). I had to add it manually because my code depends on it. --- patch data: diff -bru2 cmake-1.8.3\Source\cmLocalVisualStudio6Generator.cxx cmake-1.8.3a\Source\cmLocalVisualStudio6Generator.cxx --- cmake-1.8.3\Source\cmLocalVisualStudio6Generator.cxx Mon Jan 05 18:58:58 2004 +++ cmake-1.8.3a\Source\cmLocalVisualStudio6Generator.cxx Tue Mar 30 15:39:36 2004 @@ -962,5 +962,4 @@ } - // are there any custom rules on the target itself // only if the target is a lib or exe @@ -974,6 +973,21 @@ std::string line; + std::string output_dir, target_name; while(cmSystemTools::GetLineFromStream(fin, line)) { + if(line.compare(0, 23, "# PROP BASE Output_Dir ") == 0) + output_dir = line.substr(24, line.rfind('\"') - 24); + if((line.compare(0, 12, "# ADD LIB32 ") == 0 && + target.GetType() == cmTarget::STATIC_LIBRARY) || + (line.compare(0, 13, "# ADD LINK32 ") == 0 && + target.GetType() == cmTarget::SHARED_LIBRARY)) + { + std::string property = std::string("NAME_") + output_dir; + const char *pcTargetName = target.GetProperty(property.c_str()); + if(pcTargetName) + line += std::string(" /out:\"") + output_dir + "\\" + + pcTargetName + "\""; + } + const char* mfcFlag = m_Makefile->GetDefinition("CMAKE_MFC_FLAG"); if(!mfcFlag) diff -bru2 cmake-1.8.3\Templates\staticLibHeader.dsptemplate cmake-1.8.3a\Templates\staticLibHeader.dsptemplate --- cmake-1.8.3\Templates\staticLibHeader.dsptemplate Wed Aug 28 20:33:12 2002 +++ cmake-1.8.3a\Templates\staticLibHeader.dsptemplate Tue Mar 30 15:46:14 2004 @@ -94,4 +94,5 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo +# ADD LIB32 /nologo CMAKE_CUSTOM_RULE_CODE | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0000938) Bill Hoffman (manager) 2004-04-22 13:27 |
Although this is a nice patch it will not work with executables and utility commands because executables are not renamed. So, this feature will have to wait unil it can be done correctly in all generators and work with custom commands. |
(0016639) Brad King (manager) 2009-06-04 16:52 |
This is supported in CMake 2.6 with the <CONFIG>_OUTPUT_NAME property. http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:OUTPUT_NAME [^] |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2007-08-28 14:10 | Zack Galbreath | Project | Dart => CMake |
2007-08-28 14:11 | Zack Galbreath | Assigned To | Eric Stanton => Ken Martin |
2007-08-28 14:11 | Zack Galbreath | Severity | minor => feature |
2007-08-28 14:11 | Zack Galbreath | Status | acknowledged => assigned |
2007-08-28 14:11 | Zack Galbreath | Resolution | suspended => open |
2007-08-28 14:11 | Zack Galbreath | Category | CPack => CMake |
2007-08-28 14:11 | Zack Galbreath | Summary | Goodsite => Setting target names depending on the build type - patch for Visual Studio 6 generator |
2007-08-28 14:11 | Zack Galbreath | Note Deleted: 0008263 | |
2009-06-04 16:52 | Brad King | Note Added: 0016639 | |
2009-06-04 16:52 | Brad King | Status | assigned => closed |
2009-06-04 16:52 | Brad King | Resolution | open => fixed |
2009-06-04 16:52 | Brad King | Fixed in Version | => CMake-2-6 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |