View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0001965 | CMake | CMake | public | 2005-06-22 10:54 | 2007-08-24 11:07 | ||||
Reporter | Michael Seydl | ||||||||
Assigned To | Alex Neundorf | ||||||||
Priority | urgent | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | duplicate | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0001965: Patch for Recusrive Source Groups and Vs6 and Vs7 OutPut Path Overrides | ||||||||
Description | this patch contains the abilliy to create recusrive source groups. with the define SOURCE_GROUP_DELIMITER u r able to set the delimiter due to which the group name should be spiltted and recursed (default limiter is "\\") additionally it contains the ability to override output paths ( with EXECUTABLE_OUTPUT_PATH_OVERRIDE) which suppresses the generator to append the configuration name. (i know u should install the file to the location u want it to but u can remove the patch if it's not wanted) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | recursivegroups.patch [^] (29,184 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]? ALL_BUILD.dsp ? ALL_BUILD.dsp.cmake ? ALL_BUILD.plg ? ALL_BUILD.vcproj ? ALL_BUILD.vcproj.cmake ? ALL_BUILD_force_1.rule ? CMake.dsw ? CMake.ncb ? CMake.opt ? CMake.sln ? CMake.suo ? CMakeCCompiler.cmake ? CMakeCPlatform.cmake ? CMakeCXXCompiler.cmake ? CMakeCache.txt ? CMakeError.log ? CMakeOutput.log ? CMakeRCCompiler.cmake ? CMakeSystem.cmake ? CMakeTmp ? CTestCustom.ctest ? Continuous.dsp ? Continuous.dsp.cmake ? Continuous.vcproj ? Continuous.vcproj.cmake ? Continuous_force_1.rule ? DartConfiguration.tcl ? DartTestfile.txt ? Debug ? Experimental.dsp ? Experimental.dsp.cmake ? Experimental.vcproj ? Experimental.vcproj.cmake ? Experimental_force_1.rule ? INSTALL.dsp ? INSTALL.dsp.cmake ? INSTALL.vcproj ? INSTALL.vcproj.cmake ? INSTALL_force_1.rule ? Nightly.dsp ? Nightly.dsp.cmake ? Nightly.vcproj ? Nightly.vcproj.cmake ? NightlyMemoryCheck.dsp ? NightlyMemoryCheck.dsp.cmake ? NightlyMemoryCheck.vcproj ? NightlyMemoryCheck.vcproj.cmake ? NightlyMemoryCheck_force_1.rule ? Nightly_force_1.rule ? RUN_TESTS.dsp ? RUN_TESTS.dsp.cmake ? RUN_TESTS.vcproj ? RUN_TESTS.vcproj.cmake ? RUN_TESTS_force_1.rule ? RelWithDebInfo ? Testing ? bin ? cmake.check_cache ? cmake_install.cmake ? cmake_uninstall.cmake ? uninstall.dsp ? uninstall.dsp.cmake ? uninstall.vcproj ? uninstall.vcproj.cmake ? uninstall_force_1.rule ? Docs/CMakeSetup.1 ? Docs/CMakeSetup.html ? Docs/Copyright.txt ? Docs/cmake.1 ? Docs/cmake.html ? Docs/cmake.txt.rule ? Docs/ctest.1 ? Docs/ctest.html ? Docs/ctest.txt.rule ? Modules/.NoDartCoverage ? Modules/DartTestfile.txt ? Modules/cmake_install.cmake ? Modules/Platform/DartTestfile.txt ? Modules/Platform/cmake_install.cmake ? Source/CMakeLib.dsp ? Source/CMakeLib.dsp.cmake ? Source/CMakeLib.plg ? Source/CMakeLib.vcproj ? Source/CMakeLib.vcproj.cmake ? Source/CTestLib.dsp ? Source/CTestLib.dsp.cmake ? Source/CTestLib.vcproj ? Source/CTestLib.vcproj.cmake ? Source/DartTestfile.txt ? Source/DumpDocumentation.dsp ? Source/DumpDocumentation.dsp.cmake ? Source/DumpDocumentation.vcproj ? Source/DumpDocumentation.vcproj.cmake ? Source/RelWithDebInfo ? Source/Release ? Source/cmConfigure.h ? Source/cmake.dsp ? Source/cmake.dsp.cmake ? Source/cmake.plg ? Source/cmake.vcproj ? Source/cmake.vcproj.cmake ? Source/cmake_install.cmake ? Source/cmsys ? Source/cmw9xcom.dsp ? Source/cmw9xcom.dsp.cmake ? Source/cmw9xcom.vcproj ? Source/cmw9xcom.vcproj.cmake ? Source/ctest.dsp ? Source/ctest.dsp.cmake ? Source/ctest.vcproj ? Source/ctest.vcproj.cmake ? Source/CTest/DartTestfile.txt ? Source/CTest/cmake_install.cmake ? Source/CTest/Curl/ALL_BUILD.dsp ? Source/CTest/Curl/ALL_BUILD.dsp.cmake ? Source/CTest/Curl/ALL_BUILD.vcproj ? Source/CTest/Curl/ALL_BUILD.vcproj.cmake ? Source/CTest/Curl/ALL_BUILD_force_1.rule ? Source/CTest/Curl/Curl.dsp ? Source/CTest/Curl/Curl.dsp.cmake ? Source/CTest/Curl/Curl.vcproj ? Source/CTest/Curl/Curl.vcproj.cmake ? Source/CTest/Curl/DartTestfile.txt ? Source/CTest/Curl/Debug ? Source/CTest/Curl/INSTALL.dsp ? Source/CTest/Curl/INSTALL.dsp.cmake ? Source/CTest/Curl/INSTALL.vcproj ? Source/CTest/Curl/INSTALL.vcproj.cmake ? Source/CTest/Curl/INSTALL_force_1.rule ? Source/CTest/Curl/LIBCURL.dsp ? Source/CTest/Curl/LIBCURL.dsp.cmake ? Source/CTest/Curl/LIBCURL.dsw ? Source/CTest/Curl/LIBCURL.sln ? Source/CTest/Curl/LIBCURL.vcproj ? Source/CTest/Curl/LIBCURL.vcproj.cmake ? Source/CTest/Curl/RUN_TESTS.dsp ? Source/CTest/Curl/RUN_TESTS.dsp.cmake ? Source/CTest/Curl/RUN_TESTS.vcproj ? Source/CTest/Curl/RUN_TESTS.vcproj.cmake ? Source/CTest/Curl/RUN_TESTS_force_1.rule ? Source/CTest/Curl/RelWithDebInfo ? Source/CTest/Curl/Release ? Source/CTest/Curl/cmake_install.cmake ? Source/CTest/Curl/config.h ? Source/MFCDialog/CMakeSetup.aps ? Source/MFCDialog/CMakeSetup.dsp ? Source/MFCDialog/CMakeSetup.dsp.cmake ? Source/MFCDialog/CMakeSetup.plg ? Source/MFCDialog/CMakeSetup.vcproj ? Source/MFCDialog/CMakeSetup.vcproj.cmake ? Source/MFCDialog/DartTestfile.txt ? Source/MFCDialog/RelWithDebInfo ? Source/MFCDialog/Release ? Source/MFCDialog/cmake_install.cmake ? Source/kwsys/ALL_BUILD.dsp ? Source/kwsys/ALL_BUILD.dsp.cmake ? Source/kwsys/ALL_BUILD.vcproj ? Source/kwsys/ALL_BUILD.vcproj.cmake ? Source/kwsys/ALL_BUILD_force_1.rule ? Source/kwsys/CMakeError.log ? Source/kwsys/CMakeOutput.log ? Source/kwsys/CMakeTmp ? Source/kwsys/DartTestfile.txt ? Source/kwsys/Debug ? Source/kwsys/INSTALL.dsp ? Source/kwsys/INSTALL.dsp.cmake ? Source/kwsys/INSTALL.vcproj ? Source/kwsys/INSTALL.vcproj.cmake ? Source/kwsys/INSTALL_force_1.rule ? Source/kwsys/RUN_TESTS.dsp ? Source/kwsys/RUN_TESTS.dsp.cmake ? Source/kwsys/RUN_TESTS.vcproj ? Source/kwsys/RUN_TESTS.vcproj.cmake ? Source/kwsys/RUN_TESTS_force_1.rule ? Source/kwsys/RelWithDebInfo ? Source/kwsys/Release ? Source/kwsys/cmake_install.cmake ? Source/kwsys/cmsys.dsp ? Source/kwsys/cmsys.dsp.cmake ? Source/kwsys/cmsys.dsw ? Source/kwsys/cmsys.sln ? Source/kwsys/cmsys.vcproj ? Source/kwsys/cmsys.vcproj.cmake ? Source/kwsys/cmsysEncodeExecutable.dsp ? Source/kwsys/cmsysEncodeExecutable.dsp.cmake ? Source/kwsys/cmsysEncodeExecutable.vcproj ? Source/kwsys/cmsysEncodeExecutable.vcproj.cmake ? Source/kwsys/cmsysProcessFwd9x.dsp ? Source/kwsys/cmsysProcessFwd9x.dsp.cmake ? Source/kwsys/cmsysProcessFwd9x.vcproj ? Source/kwsys/cmsysProcessFwd9x.vcproj.cmake ? Source/kwsys/cmsysProcessFwd9xEnc.c ? Source/kwsys/cmsysProcessFwd9xEnc.c.rule ? Source/kwsys/cmsys_c.dsp ? Source/kwsys/cmsys_c.dsp.cmake ? Source/kwsys/cmsys_c.vcproj ? Source/kwsys/cmsys_c.vcproj.cmake ? Source/kwsys/testCommandLineArguments.dsp ? Source/kwsys/testCommandLineArguments.dsp.cmake ? Source/kwsys/testCommandLineArguments.vcproj ? Source/kwsys/testCommandLineArguments.vcproj.cmake ? Source/kwsys/testIOS.dsp ? Source/kwsys/testIOS.dsp.cmake ? Source/kwsys/testIOS.vcproj ? Source/kwsys/testIOS.vcproj.cmake ? Source/kwsys/testProcess.dsp ? Source/kwsys/testProcess.dsp.cmake ? Source/kwsys/testProcess.vcproj ? Source/kwsys/testProcess.vcproj.cmake ? Source/kwsys/testSystemTools.dsp ? Source/kwsys/testSystemTools.dsp.cmake ? Source/kwsys/testSystemTools.vcproj ? Source/kwsys/testSystemTools.vcproj.cmake ? Source/kwsys/testhash.dsp ? Source/kwsys/testhash.dsp.cmake ? Source/kwsys/testhash.vcproj ? Source/kwsys/testhash.vcproj.cmake ? Templates/DartTestfile.txt ? Templates/cmake_install.cmake ? Utilities/DartTestfile.txt ? Utilities/cmake_install.cmake ? Utilities/documentation.dsp ? Utilities/documentation.dsp.cmake ? Utilities/documentation.vcproj ? Utilities/documentation.vcproj.cmake ? Utilities/documentation_force_1.rule ? Utilities/documentation_force_2.rule ? Utilities/Doxygen/DartTestfile.txt ? Utilities/Doxygen/cmake_install.cmake ? Utilities/cmexpat/ALL_BUILD.dsp ? Utilities/cmexpat/ALL_BUILD.dsp.cmake ? Utilities/cmexpat/ALL_BUILD.vcproj ? Utilities/cmexpat/ALL_BUILD.vcproj.cmake ? Utilities/cmexpat/ALL_BUILD_force_1.rule ? Utilities/cmexpat/CMEXPAT.dsw ? Utilities/cmexpat/CMEXPAT.sln ? Utilities/cmexpat/DartTestfile.txt ? Utilities/cmexpat/Debug ? Utilities/cmexpat/INSTALL.dsp ? Utilities/cmexpat/INSTALL.dsp.cmake ? Utilities/cmexpat/INSTALL.vcproj ? Utilities/cmexpat/INSTALL.vcproj.cmake ? Utilities/cmexpat/INSTALL_force_1.rule ? Utilities/cmexpat/RUN_TESTS.dsp ? Utilities/cmexpat/RUN_TESTS.dsp.cmake ? Utilities/cmexpat/RUN_TESTS.vcproj ? Utilities/cmexpat/RUN_TESTS.vcproj.cmake ? Utilities/cmexpat/RUN_TESTS_force_1.rule ? Utilities/cmexpat/RelWithDebInfo ? Utilities/cmexpat/Release ? Utilities/cmexpat/cmake_install.cmake ? Utilities/cmexpat/cmexpat.dsp ? Utilities/cmexpat/cmexpat.dsp.cmake ? Utilities/cmexpat/cmexpat.vcproj ? Utilities/cmexpat/cmexpat.vcproj.cmake ? Utilities/cmexpat/expatConfig.h ? Utilities/cmexpat/expatDllConfig.h ? Utilities/cmxmlrpc/ALL_BUILD.dsp ? Utilities/cmxmlrpc/ALL_BUILD.dsp.cmake ? Utilities/cmxmlrpc/ALL_BUILD.vcproj ? Utilities/cmxmlrpc/ALL_BUILD.vcproj.cmake ? Utilities/cmxmlrpc/ALL_BUILD_force_1.rule ? Utilities/cmxmlrpc/DartTestfile.txt ? Utilities/cmxmlrpc/Debug ? Utilities/cmxmlrpc/INSTALL.dsp ? Utilities/cmxmlrpc/INSTALL.dsp.cmake ? Utilities/cmxmlrpc/INSTALL.vcproj ? Utilities/cmxmlrpc/INSTALL.vcproj.cmake ? Utilities/cmxmlrpc/INSTALL_force_1.rule ? Utilities/cmxmlrpc/RUN_TESTS.dsp ? Utilities/cmxmlrpc/RUN_TESTS.dsp.cmake ? Utilities/cmxmlrpc/RUN_TESTS.vcproj ? Utilities/cmxmlrpc/RUN_TESTS.vcproj.cmake ? Utilities/cmxmlrpc/RUN_TESTS_force_1.rule ? Utilities/cmxmlrpc/RelWithDebInfo ? Utilities/cmxmlrpc/Release ? Utilities/cmxmlrpc/XMLRPC.dsw ? Utilities/cmxmlrpc/XMLRPC.sln ? Utilities/cmxmlrpc/cmXMLRPC.dsp ? Utilities/cmxmlrpc/cmXMLRPC.dsp.cmake ? Utilities/cmxmlrpc/cmXMLRPC.vcproj ? Utilities/cmxmlrpc/cmXMLRPC.vcproj.cmake ? Utilities/cmxmlrpc/cmake_install.cmake ? Utilities/cmxmlrpc/xmlrpc_amconfig.h ? Utilities/cmxmlrpc/xmlrpc_config.h ? Utilities/cmxmlrpc/xrtest.dsp ? Utilities/cmxmlrpc/xrtest.dsp.cmake ? Utilities/cmxmlrpc/xrtest.vcproj ? Utilities/cmxmlrpc/xrtest.vcproj.cmake ? Utilities/cmzlib/ALL_BUILD.dsp ? Utilities/cmzlib/ALL_BUILD.dsp.cmake ? Utilities/cmzlib/ALL_BUILD.vcproj ? Utilities/cmzlib/ALL_BUILD.vcproj.cmake ? Utilities/cmzlib/ALL_BUILD_force_1.rule ? Utilities/cmzlib/CMZLIB.dsw ? Utilities/cmzlib/CMZLIB.sln ? Utilities/cmzlib/DartTestfile.txt ? Utilities/cmzlib/Debug ? Utilities/cmzlib/INSTALL.dsp ? Utilities/cmzlib/INSTALL.dsp.cmake ? Utilities/cmzlib/INSTALL.vcproj ? Utilities/cmzlib/INSTALL.vcproj.cmake ? Utilities/cmzlib/INSTALL_force_1.rule ? Utilities/cmzlib/RUN_TESTS.dsp ? Utilities/cmzlib/RUN_TESTS.dsp.cmake ? Utilities/cmzlib/RUN_TESTS.vcproj ? Utilities/cmzlib/RUN_TESTS.vcproj.cmake ? Utilities/cmzlib/RUN_TESTS_force_1.rule ? Utilities/cmzlib/RelWithDebInfo ? Utilities/cmzlib/Release ? Utilities/cmzlib/cmake_install.cmake ? Utilities/cmzlib/cmzlib.dsp ? Utilities/cmzlib/cmzlib.dsp.cmake ? Utilities/cmzlib/cmzlib.vcproj ? Utilities/cmzlib/cmzlib.vcproj.cmake ? Utilities/cmzlib/zlibDllConfig.h Index: Source/cmLocalVisualStudio6Generator.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v retrieving revision 1.76 diff -u -r1.76 cmLocalVisualStudio6Generator.cxx --- Source/cmLocalVisualStudio6Generator.cxx 16 Jun 2005 15:48:42 -0000 1.76 +++ Source/cmLocalVisualStudio6Generator.cxx 22 Jun 2005 14:29:02 -0000 @@ -316,12 +316,23 @@ for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); sg != sourceGroups.end(); ++sg) { - const std::vector<const cmSourceFile *> &sourceFiles = + WriteGroup(&(*sg), target, fout, libName); + + } + + // Write the DSP file's footer. + this->WriteDSPFooter(fout); +} + +void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName) +{ + const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. - if(sourceFiles.empty()) + + if(sourceFiles.empty()) { - continue; + return; } // If the group has a name, write the header. @@ -410,16 +421,21 @@ fout << "# End Source File\n"; } } + + std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + + for(int i=0;i<children.size();++i) + WriteGroup(&children[i], target, fout, libName); + + + // If the group has a name, write the footer. if(name != "") { this->WriteDSPEndGroup(fout); } - } - // Write the DSP file's footer. - this->WriteDSPFooter(fout); } @@ -1088,10 +1104,29 @@ cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH", removeQuotes( this->ConvertToOptionallyRelativeOutputPath(libPath.c_str())).c_str()); + + + if (!m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH_OVERRIDE") || exePath == "") + { cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH", removeQuotes( this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); - cmSystemTools::ReplaceString(line, + } else + { + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHRelease", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHDebug", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHMinSizeRel", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHRelWithDebInfo", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + } + cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); const char* debugPostfix Index: Source/cmLocalVisualStudio6Generator.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.h,v retrieving revision 1.7 diff -u -r1.7 cmLocalVisualStudio6Generator.h --- Source/cmLocalVisualStudio6Generator.h 26 Apr 2005 15:08:18 -0000 1.7 +++ Source/cmLocalVisualStudio6Generator.h 6 Jun 2005 07:08:10 -0000 @@ -91,6 +91,8 @@ std::vector<std::string>& depends, const cmCustomCommandLines& commandLines); + void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName); + std::string CreateTargetRules(const cmTarget &target, const char *libName); std::string m_IncludeOptions; Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v retrieving revision 1.81 diff -u -r1.81 cmLocalVisualStudio7Generator.cxx --- Source/cmLocalVisualStudio7Generator.cxx 16 Jun 2005 15:48:42 -0000 1.81 +++ Source/cmLocalVisualStudio7Generator.cxx 22 Jun 2005 13:37:48 -0000 @@ -724,7 +724,10 @@ this->OutputLibraries(fout, configName, libName, target); fout << "\"\n"; temp = m_ExecutableOutputPath; - temp += configName; + + if (!m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH_OVERRIDE")) + temp += configName; + temp += "/"; // do we have a different executable name? @@ -988,15 +991,32 @@ // Loop through every source group. - for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); - sg != sourceGroups.end(); ++sg) - { - const std::vector<const cmSourceFile *> &sourceFiles = +// for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); + // sg != sourceGroups.end(); ++sg) + // { + + for(int i = 0; i < sourceGroups.size(); ++i) + { + cmSourceGroup sg = sourceGroups[i]; + WriteGroup(&sg, target, fout, libName, configs); + } + + //} + + fout << "\t</Files>\n"; + + // Write the VCProj file's footer. + this->WriteVCProjFooter(fout); +} + +void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs) +{ + const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. if(sourceFiles.empty()) { - continue; + return; } // If the group has a name, write the header. @@ -1104,19 +1124,18 @@ fout << "\t\t\t</File>\n"; } } - - // If the group has a name, write the footer. + + std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + + for(int i=0;i<children.size();++i) + WriteGroup(&children[i], target, fout, libName, configs); + + // If the group has a name, write the footer. if(name != "") { this->WriteVCProjEndGroup(fout); } - } - fout << "\t</Files>\n"; - - // Write the VCProj file's footer. - this->WriteVCProjFooter(fout); -} - +} void cmLocalVisualStudio7Generator:: WriteCustomRule(std::ostream& fout, Index: Source/cmLocalVisualStudio7Generator.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v retrieving revision 1.11 diff -u -r1.11 cmLocalVisualStudio7Generator.h --- Source/cmLocalVisualStudio7Generator.h 18 Mar 2005 15:41:41 -0000 1.11 +++ Source/cmLocalVisualStudio7Generator.h 22 Jun 2005 11:09:22 -0000 @@ -116,6 +116,8 @@ const char* output, const char* extraFlags); + void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs); + std::vector<std::string> m_CreatedProjectNames; std::string m_LibraryOutputPath; std::string m_ExecutableOutputPath; Index: Source/cmMakefile.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v retrieving revision 1.297 diff -u -r1.297 cmMakefile.cxx --- Source/cmMakefile.cxx 20 Jun 2005 20:24:37 -0000 1.297 +++ Source/cmMakefile.cxx 22 Jun 2005 08:45:36 -0000 @@ -1223,31 +1223,87 @@ if(sgName == name) { return &(*sg); - } + } + else + { + cmSourceGroup *target = sg->lookupChild(name); + + if(target) + return target; + } } return 0; } -void cmMakefile::AddSourceGroup(const char* name, const char* regex) +void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char *parent) { - // First see if the group exists. If so, replace its regular expression. - for(std::vector<cmSourceGroup>::iterator sg = m_SourceGroups.begin(); - sg != m_SourceGroups.end(); ++sg) + // First see if the group exists. If so, replace its regular expression. + for(int i=0;i<m_SourceGroups.size();++i) { - std::string sgName = sg->GetName(); - if(sgName == name) - { - if ( regex ) - { - // We only want to set the regular expression. If there are already - // source files in the group, we don't want to remove them. - sg->SetGroupRegex(regex); - } - return; - } - } - - // The group doesn't exist. Add it. + cmSourceGroup *sg = &m_SourceGroups[i]; + + std::string sgName = sg->GetName(); + if(!parent) + { + if(sgName == name) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + sg->SetGroupRegex(regex); + } + return; + } + } + else + { + if(sgName == parent) + { + cmSourceGroup *localtarget = sg->lookupChild(name); + if(localtarget) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + localtarget->SetGroupRegex(regex); + } + } + else + { + sg->AddChild(cmSourceGroup(name, regex)); + } + return; + } + else + { + cmSourceGroup *localtarget = sg->lookupChild(parent); + + if(localtarget) + { + cmSourceGroup *addtarget = localtarget->lookupChild(name); + + if(addtarget) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + addtarget->SetGroupRegex(regex); + } + } + else + { + localtarget->AddChild(cmSourceGroup(name, regex)); + } + return; + } + } + } + } + + // The group doesn't exist. Add it. m_SourceGroups.push_back(cmSourceGroup(name, regex)); } @@ -1692,22 +1748,25 @@ for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); sg != groups.rend(); ++sg) { - if(sg->MatchesFiles(source)) - { - return *sg; - } + cmSourceGroup *result = sg->MatchChildrenFiles(source); + if(result) + { + return *result; + } } // Now search for a group whose regex matches the file. for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); sg != groups.rend(); ++sg) { - if(sg->MatchesRegex(source)) - { - return *sg; - } + cmSourceGroup *result = sg->MatchChildrenRegex(source); + if(result) + { + return *result; + } } - + + // Shouldn't get here, but just in case, return the default group. return groups.front(); } Index: Source/cmMakefile.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v retrieving revision 1.166 diff -u -r1.166 cmMakefile.h --- Source/cmMakefile.h 17 Jun 2005 19:50:08 -0000 1.166 +++ Source/cmMakefile.h 22 Jun 2005 08:45:36 -0000 @@ -280,7 +280,7 @@ /** * Add a source group for consideration when adding a new source. */ - void AddSourceGroup(const char* name, const char* regex=0); + void AddSourceGroup(const char* name, const char* regex=0, const char* parent=0); /** * Add an auxiliary directory to the build. Index: Source/cmSourceGroup.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroup.cxx,v retrieving revision 1.16 diff -u -r1.16 cmSourceGroup.cxx --- Source/cmSourceGroup.cxx 23 Jul 2003 19:32:54 -0000 1.16 +++ Source/cmSourceGroup.cxx 3 Mar 2005 15:01:10 -0000 @@ -81,3 +81,95 @@ { return m_SourceFiles; } + +//---------------------------------------------------------------------------- +void cmSourceGroup::AddChild(cmSourceGroup child) +{ + m_GroupChildren.push_back(child); +} + +//---------------------------------------------------------------------------- +cmSourceGroup *cmSourceGroup::lookupChild(const char* name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + // st + for(; + iter!=end; + ++iter) + { + std::string sgName = iter->GetName(); + + // look if descenened is the one were looking for + if(sgName == name) + return &(*iter); // if it so return it + + // if the descendend isn't the one where looking for ask it's traverse + cmSourceGroup *result = iter->lookupChild(name); + + // if one of it's descendeds is the one we're looking for return it + if(result) + return result; + } + + // if no child with this name was found return NULL + return NULL; +} + +cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesFiles(name)) + return this; + + + // st + for(; + iter!=end; + ++iter) + { + + cmSourceGroup *result = iter->MatchChildrenFiles(name); + + if(result) + return result; + } + + return NULL; +} + + +cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesRegex(name)) + return this; + + + // st + for(; + iter!=end; + ++iter) + { + + cmSourceGroup *result = iter->MatchChildrenRegex(name); + + if(result) + return result; + } + + return NULL; +} + +std::vector<cmSourceGroup> cmSourceGroup::GetGroupChildren() const +{ + return m_GroupChildren; +} Index: Source/cmSourceGroup.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroup.h,v retrieving revision 1.16 diff -u -r1.16 cmSourceGroup.h --- Source/cmSourceGroup.h 23 Jul 2003 19:32:54 -0000 1.16 +++ Source/cmSourceGroup.h 2 Mar 2005 14:01:14 -0000 @@ -47,6 +47,16 @@ * Add a file name to the explicit list of files for this group. */ void AddGroupFile(const char* name); + + /** + * Add child to this sourcegroup + */ + void AddChild(cmSourceGroup child); + + /** + * Looks up child and returns it + */ + cmSourceGroup *lookupChild(const char *name); /** * Get the name of this group. @@ -62,6 +72,16 @@ * Check if the given name matches this group's explicit file list. */ bool MatchesFiles(const char* name); + + /** + * Check if the given name matches this group's explicit file list in children. + */ + cmSourceGroup *MatchChildrenFiles(const char *name); + + /** + * Check if the given name matches this group's regex in children. + */ + cmSourceGroup *MatchChildrenRegex(const char *name); /** * Assign the given source file to this group. Used only by @@ -76,6 +96,7 @@ const std::vector<const cmSourceFile*>& GetSourceFiles() const; std::vector<const cmSourceFile*>& GetSourceFiles(); + std::vector<cmSourceGroup> GetGroupChildren() const; private: /** * The name of the source group. @@ -97,6 +118,8 @@ * this group. */ std::vector<const cmSourceFile*> m_SourceFiles; + + std::vector<cmSourceGroup> m_GroupChildren; }; #endif Index: Source/cmSourceGroupCommand.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroupCommand.cxx,v retrieving revision 1.11 diff -u -r1.11 cmSourceGroupCommand.cxx --- Source/cmSourceGroupCommand.cxx 28 Jul 2003 18:43:04 -0000 1.11 +++ Source/cmSourceGroupCommand.cxx 22 Jun 2005 14:41:36 -0000 @@ -16,6 +16,30 @@ =========================================================================*/ #include "cmSourceGroupCommand.h" +std::vector<std::string> tokenize(const std::string& str,const std::string& sep, bool skipEmptyTokens) throw() +{ + std::vector<std::string> tokens; + std::string::size_type tokstart,tokend; + + if (skipEmptyTokens) tokend=0; + else tokend=std::string::npos; + + do + { + if (skipEmptyTokens) tokstart=str.find_first_not_of(sep,tokend); + else tokstart=tokend+1; + + if (tokstart==std::string::npos) break; // no more tokens + tokend=str.find_first_of(sep,tokstart); + if (tokend==std::string::npos) + tokens.push_back(str.substr(tokstart)); + else + tokens.push_back(str.substr(tokstart,tokend-tokstart)); + } while (tokend!=std::string::npos); + + return tokens; +} + // cmSourceGroupCommand bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args) { @@ -24,18 +48,33 @@ this->SetError("called with incorrect number of arguments"); return false; } - - // Get the source group with the given name. - cmSourceGroup* sg = m_Makefile->GetSourceGroup(args[0].c_str()); - if(!sg) - { - m_Makefile->AddSourceGroup(args[0].c_str(), 0); - sg = m_Makefile->GetSourceGroup(args[0].c_str()); - } - + + std::string delimiter = "\\"; + + if(m_Makefile->GetDefinition("SOURCE_GROUP_DELIMITER")) + delimiter = m_Makefile->GetDefinition("SOURCE_GROUP_DELIMITER"); + + std::vector<std::string> folders = tokenize(args[0], delimiter, true); + + const char *parent = NULL; + + cmSourceGroup* sg = NULL; + + for(int i=0;i<folders.size();++i) + { + sg = m_Makefile->GetSourceGroup(folders[i].c_str()); + + if(!sg) + m_Makefile->AddSourceGroup(folders[i].c_str(), 0, parent); + + sg = m_Makefile->GetSourceGroup(folders[i].c_str()); + + parent = folders[i].c_str(); + } + // If only two arguments are given, the pre-1.8 version of the // command is being invoked. - if(args.size() == 2 && args[1] != "FILES") + if(args.size() == 2 && args[1] != "FILES") { sg->SetGroupRegex(args[1].c_str()); return true; recursivegroupsv2.patch [^] (31,166 bytes) 1969-12-31 19:00 [Show Content] [Hide Content] ? ALL_BUILD.dsp ? ALL_BUILD.dsp.cmake ? ALL_BUILD.plg ? ALL_BUILD.vcproj ? ALL_BUILD.vcproj.cmake ? ALL_BUILD_force_1.rule ? CMake.dsw ? CMake.ncb ? CMake.opt ? CMake.sln ? CMake.suo ? CMakeCCompiler.cmake ? CMakeCPlatform.cmake ? CMakeCXXCompiler.cmake ? CMakeCache.txt ? CMakeError.log ? CMakeOutput.log ? CMakeRCCompiler.cmake ? CMakeSystem.cmake ? CMakeTmp ? CTestCustom.ctest ? Continuous.dsp ? Continuous.dsp.cmake ? Continuous.vcproj ? Continuous.vcproj.cmake ? Continuous_force_1.rule ? DartConfiguration.tcl ? DartTestfile.txt ? Debug ? Experimental.dsp ? Experimental.dsp.cmake ? Experimental.vcproj ? Experimental.vcproj.cmake ? Experimental_force_1.rule ? INSTALL.dsp ? INSTALL.dsp.cmake ? INSTALL.vcproj ? INSTALL.vcproj.cmake ? INSTALL_force_1.rule ? Nightly.dsp ? Nightly.dsp.cmake ? Nightly.vcproj ? Nightly.vcproj.cmake ? NightlyMemoryCheck.dsp ? NightlyMemoryCheck.dsp.cmake ? NightlyMemoryCheck.vcproj ? NightlyMemoryCheck.vcproj.cmake ? NightlyMemoryCheck_force_1.rule ? Nightly_force_1.rule ? RUN_TESTS.dsp ? RUN_TESTS.dsp.cmake ? RUN_TESTS.vcproj ? RUN_TESTS.vcproj.cmake ? RUN_TESTS_force_1.rule ? RelWithDebInfo ? Testing ? bin ? cmake.check_cache ? cmake_install.cmake ? cmake_uninstall.cmake ? uninstall.dsp ? uninstall.dsp.cmake ? uninstall.vcproj ? uninstall.vcproj.cmake ? uninstall_force_1.rule ? Docs/CMakeSetup.1 ? Docs/CMakeSetup.html ? Docs/Copyright.txt ? Docs/cmake.1 ? Docs/cmake.html ? Docs/cmake.txt.rule ? Docs/ctest.1 ? Docs/ctest.html ? Docs/ctest.txt.rule ? Modules/.NoDartCoverage ? Modules/DartTestfile.txt ? Modules/cmake_install.cmake ? Modules/Platform/DartTestfile.txt ? Modules/Platform/cmake_install.cmake ? Source/CMakeLib.dsp ? Source/CMakeLib.dsp.cmake ? Source/CMakeLib.plg ? Source/CMakeLib.vcproj ? Source/CMakeLib.vcproj.cmake ? Source/CTestLib.dsp ? Source/CTestLib.dsp.cmake ? Source/CTestLib.vcproj ? Source/CTestLib.vcproj.cmake ? Source/DartTestfile.txt ? Source/DumpDocumentation.dsp ? Source/DumpDocumentation.dsp.cmake ? Source/DumpDocumentation.vcproj ? Source/DumpDocumentation.vcproj.cmake ? Source/RelWithDebInfo ? Source/Release ? Source/cmConfigure.h ? Source/cmake.dsp ? Source/cmake.dsp.cmake ? Source/cmake.plg ? Source/cmake.vcproj ? Source/cmake.vcproj.cmake ? Source/cmake_install.cmake ? Source/cmsys ? Source/cmw9xcom.dsp ? Source/cmw9xcom.dsp.cmake ? Source/cmw9xcom.vcproj ? Source/cmw9xcom.vcproj.cmake ? Source/ctest.dsp ? Source/ctest.dsp.cmake ? Source/ctest.vcproj ? Source/ctest.vcproj.cmake ? Source/CTest/DartTestfile.txt ? Source/CTest/cmake_install.cmake ? Source/CTest/Curl/ALL_BUILD.dsp ? Source/CTest/Curl/ALL_BUILD.dsp.cmake ? Source/CTest/Curl/ALL_BUILD.vcproj ? Source/CTest/Curl/ALL_BUILD.vcproj.cmake ? Source/CTest/Curl/ALL_BUILD_force_1.rule ? Source/CTest/Curl/Curl.dsp ? Source/CTest/Curl/Curl.dsp.cmake ? Source/CTest/Curl/Curl.vcproj ? Source/CTest/Curl/Curl.vcproj.cmake ? Source/CTest/Curl/DartTestfile.txt ? Source/CTest/Curl/Debug ? Source/CTest/Curl/INSTALL.dsp ? Source/CTest/Curl/INSTALL.dsp.cmake ? Source/CTest/Curl/INSTALL.vcproj ? Source/CTest/Curl/INSTALL.vcproj.cmake ? Source/CTest/Curl/INSTALL_force_1.rule ? Source/CTest/Curl/LIBCURL.dsp ? Source/CTest/Curl/LIBCURL.dsp.cmake ? Source/CTest/Curl/LIBCURL.dsw ? Source/CTest/Curl/LIBCURL.sln ? Source/CTest/Curl/LIBCURL.vcproj ? Source/CTest/Curl/LIBCURL.vcproj.cmake ? Source/CTest/Curl/RUN_TESTS.dsp ? Source/CTest/Curl/RUN_TESTS.dsp.cmake ? Source/CTest/Curl/RUN_TESTS.vcproj ? Source/CTest/Curl/RUN_TESTS.vcproj.cmake ? Source/CTest/Curl/RUN_TESTS_force_1.rule ? Source/CTest/Curl/RelWithDebInfo ? Source/CTest/Curl/Release ? Source/CTest/Curl/cmake_install.cmake ? Source/CTest/Curl/config.h ? Source/MFCDialog/CMakeSetup.aps ? Source/MFCDialog/CMakeSetup.dsp ? Source/MFCDialog/CMakeSetup.dsp.cmake ? Source/MFCDialog/CMakeSetup.plg ? Source/MFCDialog/CMakeSetup.vcproj ? Source/MFCDialog/CMakeSetup.vcproj.cmake ? Source/MFCDialog/DartTestfile.txt ? Source/MFCDialog/RelWithDebInfo ? Source/MFCDialog/Release ? Source/MFCDialog/cmake_install.cmake ? Source/kwsys/ALL_BUILD.dsp ? Source/kwsys/ALL_BUILD.dsp.cmake ? Source/kwsys/ALL_BUILD.vcproj ? Source/kwsys/ALL_BUILD.vcproj.cmake ? Source/kwsys/ALL_BUILD_force_1.rule ? Source/kwsys/CMakeError.log ? Source/kwsys/CMakeOutput.log ? Source/kwsys/CMakeTmp ? Source/kwsys/DartTestfile.txt ? Source/kwsys/Debug ? Source/kwsys/INSTALL.dsp ? Source/kwsys/INSTALL.dsp.cmake ? Source/kwsys/INSTALL.vcproj ? Source/kwsys/INSTALL.vcproj.cmake ? Source/kwsys/INSTALL_force_1.rule ? Source/kwsys/RUN_TESTS.dsp ? Source/kwsys/RUN_TESTS.dsp.cmake ? Source/kwsys/RUN_TESTS.vcproj ? Source/kwsys/RUN_TESTS.vcproj.cmake ? Source/kwsys/RUN_TESTS_force_1.rule ? Source/kwsys/RelWithDebInfo ? Source/kwsys/Release ? Source/kwsys/cmake_install.cmake ? Source/kwsys/cmsys.dsp ? Source/kwsys/cmsys.dsp.cmake ? Source/kwsys/cmsys.dsw ? Source/kwsys/cmsys.sln ? Source/kwsys/cmsys.vcproj ? Source/kwsys/cmsys.vcproj.cmake ? Source/kwsys/cmsysEncodeExecutable.dsp ? Source/kwsys/cmsysEncodeExecutable.dsp.cmake ? Source/kwsys/cmsysEncodeExecutable.vcproj ? Source/kwsys/cmsysEncodeExecutable.vcproj.cmake ? Source/kwsys/cmsysProcessFwd9x.dsp ? Source/kwsys/cmsysProcessFwd9x.dsp.cmake ? Source/kwsys/cmsysProcessFwd9x.vcproj ? Source/kwsys/cmsysProcessFwd9x.vcproj.cmake ? Source/kwsys/cmsysProcessFwd9xEnc.c ? Source/kwsys/cmsysProcessFwd9xEnc.c.rule ? Source/kwsys/cmsys_c.dsp ? Source/kwsys/cmsys_c.dsp.cmake ? Source/kwsys/cmsys_c.vcproj ? Source/kwsys/cmsys_c.vcproj.cmake ? Source/kwsys/testCommandLineArguments.dsp ? Source/kwsys/testCommandLineArguments.dsp.cmake ? Source/kwsys/testCommandLineArguments.vcproj ? Source/kwsys/testCommandLineArguments.vcproj.cmake ? Source/kwsys/testIOS.dsp ? Source/kwsys/testIOS.dsp.cmake ? Source/kwsys/testIOS.vcproj ? Source/kwsys/testIOS.vcproj.cmake ? Source/kwsys/testProcess.dsp ? Source/kwsys/testProcess.dsp.cmake ? Source/kwsys/testProcess.vcproj ? Source/kwsys/testProcess.vcproj.cmake ? Source/kwsys/testSystemTools.dsp ? Source/kwsys/testSystemTools.dsp.cmake ? Source/kwsys/testSystemTools.vcproj ? Source/kwsys/testSystemTools.vcproj.cmake ? Source/kwsys/testhash.dsp ? Source/kwsys/testhash.dsp.cmake ? Source/kwsys/testhash.vcproj ? Source/kwsys/testhash.vcproj.cmake ? Templates/DartTestfile.txt ? Templates/cmake_install.cmake ? Utilities/DartTestfile.txt ? Utilities/cmake_install.cmake ? Utilities/documentation.dsp ? Utilities/documentation.dsp.cmake ? Utilities/documentation.vcproj ? Utilities/documentation.vcproj.cmake ? Utilities/documentation_force_1.rule ? Utilities/documentation_force_2.rule ? Utilities/Doxygen/DartTestfile.txt ? Utilities/Doxygen/cmake_install.cmake ? Utilities/cmexpat/ALL_BUILD.dsp ? Utilities/cmexpat/ALL_BUILD.dsp.cmake ? Utilities/cmexpat/ALL_BUILD.vcproj ? Utilities/cmexpat/ALL_BUILD.vcproj.cmake ? Utilities/cmexpat/ALL_BUILD_force_1.rule ? Utilities/cmexpat/CMEXPAT.dsw ? Utilities/cmexpat/CMEXPAT.sln ? Utilities/cmexpat/DartTestfile.txt ? Utilities/cmexpat/Debug ? Utilities/cmexpat/INSTALL.dsp ? Utilities/cmexpat/INSTALL.dsp.cmake ? Utilities/cmexpat/INSTALL.vcproj ? Utilities/cmexpat/INSTALL.vcproj.cmake ? Utilities/cmexpat/INSTALL_force_1.rule ? Utilities/cmexpat/RUN_TESTS.dsp ? Utilities/cmexpat/RUN_TESTS.dsp.cmake ? Utilities/cmexpat/RUN_TESTS.vcproj ? Utilities/cmexpat/RUN_TESTS.vcproj.cmake ? Utilities/cmexpat/RUN_TESTS_force_1.rule ? Utilities/cmexpat/RelWithDebInfo ? Utilities/cmexpat/Release ? Utilities/cmexpat/cmake_install.cmake ? Utilities/cmexpat/cmexpat.dsp ? Utilities/cmexpat/cmexpat.dsp.cmake ? Utilities/cmexpat/cmexpat.vcproj ? Utilities/cmexpat/cmexpat.vcproj.cmake ? Utilities/cmexpat/expatConfig.h ? Utilities/cmexpat/expatDllConfig.h ? Utilities/cmxmlrpc/ALL_BUILD.dsp ? Utilities/cmxmlrpc/ALL_BUILD.dsp.cmake ? Utilities/cmxmlrpc/ALL_BUILD.vcproj ? Utilities/cmxmlrpc/ALL_BUILD.vcproj.cmake ? Utilities/cmxmlrpc/ALL_BUILD_force_1.rule ? Utilities/cmxmlrpc/DartTestfile.txt ? Utilities/cmxmlrpc/Debug ? Utilities/cmxmlrpc/INSTALL.dsp ? Utilities/cmxmlrpc/INSTALL.dsp.cmake ? Utilities/cmxmlrpc/INSTALL.vcproj ? Utilities/cmxmlrpc/INSTALL.vcproj.cmake ? Utilities/cmxmlrpc/INSTALL_force_1.rule ? Utilities/cmxmlrpc/RUN_TESTS.dsp ? Utilities/cmxmlrpc/RUN_TESTS.dsp.cmake ? Utilities/cmxmlrpc/RUN_TESTS.vcproj ? Utilities/cmxmlrpc/RUN_TESTS.vcproj.cmake ? Utilities/cmxmlrpc/RUN_TESTS_force_1.rule ? Utilities/cmxmlrpc/RelWithDebInfo ? Utilities/cmxmlrpc/Release ? Utilities/cmxmlrpc/XMLRPC.dsw ? Utilities/cmxmlrpc/XMLRPC.sln ? Utilities/cmxmlrpc/cmXMLRPC.dsp ? Utilities/cmxmlrpc/cmXMLRPC.dsp.cmake ? Utilities/cmxmlrpc/cmXMLRPC.vcproj ? Utilities/cmxmlrpc/cmXMLRPC.vcproj.cmake ? Utilities/cmxmlrpc/cmake_install.cmake ? Utilities/cmxmlrpc/xmlrpc_amconfig.h ? Utilities/cmxmlrpc/xmlrpc_config.h ? Utilities/cmxmlrpc/xrtest.dsp ? Utilities/cmxmlrpc/xrtest.dsp.cmake ? Utilities/cmxmlrpc/xrtest.vcproj ? Utilities/cmxmlrpc/xrtest.vcproj.cmake ? Utilities/cmzlib/ALL_BUILD.dsp ? Utilities/cmzlib/ALL_BUILD.dsp.cmake ? Utilities/cmzlib/ALL_BUILD.vcproj ? Utilities/cmzlib/ALL_BUILD.vcproj.cmake ? Utilities/cmzlib/ALL_BUILD_force_1.rule ? Utilities/cmzlib/CMZLIB.dsw ? Utilities/cmzlib/CMZLIB.sln ? Utilities/cmzlib/DartTestfile.txt ? Utilities/cmzlib/Debug ? Utilities/cmzlib/INSTALL.dsp ? Utilities/cmzlib/INSTALL.dsp.cmake ? Utilities/cmzlib/INSTALL.vcproj ? Utilities/cmzlib/INSTALL.vcproj.cmake ? Utilities/cmzlib/INSTALL_force_1.rule ? Utilities/cmzlib/RUN_TESTS.dsp ? Utilities/cmzlib/RUN_TESTS.dsp.cmake ? Utilities/cmzlib/RUN_TESTS.vcproj ? Utilities/cmzlib/RUN_TESTS.vcproj.cmake ? Utilities/cmzlib/RUN_TESTS_force_1.rule ? Utilities/cmzlib/RelWithDebInfo ? Utilities/cmzlib/Release ? Utilities/cmzlib/cmake_install.cmake ? Utilities/cmzlib/cmzlib.dsp ? Utilities/cmzlib/cmzlib.dsp.cmake ? Utilities/cmzlib/cmzlib.vcproj ? Utilities/cmzlib/cmzlib.vcproj.cmake ? Utilities/cmzlib/zlibDllConfig.h Index: Source/cmLocalVisualStudio6Generator.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v retrieving revision 1.76 diff -u -r1.76 cmLocalVisualStudio6Generator.cxx --- Source/cmLocalVisualStudio6Generator.cxx 16 Jun 2005 15:48:42 -0000 1.76 +++ Source/cmLocalVisualStudio6Generator.cxx 23 Jun 2005 07:24:44 -0000 @@ -316,12 +316,23 @@ for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); sg != sourceGroups.end(); ++sg) { - const std::vector<const cmSourceFile *> &sourceFiles = + WriteGroup(&(*sg), target, fout, libName); + + } + + // Write the DSP file's footer. + this->WriteDSPFooter(fout); +} + +void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName) +{ + const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. - if(sourceFiles.empty()) + + if(sourceFiles.empty()) { - continue; + return; } // If the group has a name, write the header. @@ -410,16 +421,21 @@ fout << "# End Source File\n"; } } + + std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + + for(int i=0;i<children.size();++i) + WriteGroup(&children[i], target, fout, libName); + + + // If the group has a name, write the footer. if(name != "") { this->WriteDSPEndGroup(fout); } - } - // Write the DSP file's footer. - this->WriteDSPFooter(fout); } @@ -764,10 +780,12 @@ libPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"); } std::string exePath = ""; + std::string exePathDebug = ""; if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { exePath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); - } + + } if(libPath.size()) { // make sure there is a trailing slash @@ -953,14 +971,38 @@ extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); + // if the executable has an output name then add the appropriate flag if (target.GetProperty("OUTPUT_NAME")) { + std::string outputname = target.GetProperty("OUTPUT_NAME"); libMultiLineOptions += "# ADD LINK32 /out:"; - libMultiLineOptions += target.GetProperty("OUTPUT_NAME"); + libMultiLineOptions += outputname; libMultiLineOptions += " \n"; } - } + else + { + + libMultiLineOptions += "# ADD LINK32 /out:\""; + + if(exePath != "") + libMultiLineOptions += exePath + "/" + libName + ".exe"; + else + libMultiLineOptions += std::string(libName) + ".exe"; + + libMultiLineOptions += "\"\n"; + + + libMultiLineOptionsForDebug += "# ADD LINK32 /out:\""; + + if(exePath != "") + libMultiLineOptionsForDebug += exePath + "/" + libName + "D.exe"; + else + libMultiLineOptionsForDebug += std::string(libName) + "D.exe"; + + libMultiLineOptionsForDebug += "\"\n"; + } + } if(target.GetType() == cmTarget::SHARED_LIBRARY) { extraLinkOptions = m_Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); @@ -1088,10 +1130,29 @@ cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH", removeQuotes( this->ConvertToOptionallyRelativeOutputPath(libPath.c_str())).c_str()); + + + if (!m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH_OVERRIDE") || exePath == "") + { cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH", removeQuotes( this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); - cmSystemTools::ReplaceString(line, + } else + { + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHRelease", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHDebug", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHMinSizeRel", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATHRelWithDebInfo", + removeQuotes( + this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str()); + } + cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); const char* debugPostfix Index: Source/cmLocalVisualStudio6Generator.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.h,v retrieving revision 1.7 diff -u -r1.7 cmLocalVisualStudio6Generator.h --- Source/cmLocalVisualStudio6Generator.h 26 Apr 2005 15:08:18 -0000 1.7 +++ Source/cmLocalVisualStudio6Generator.h 6 Jun 2005 07:08:10 -0000 @@ -91,6 +91,8 @@ std::vector<std::string>& depends, const cmCustomCommandLines& commandLines); + void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName); + std::string CreateTargetRules(const cmTarget &target, const char *libName); std::string m_IncludeOptions; Index: Source/cmLocalVisualStudio7Generator.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v retrieving revision 1.81 diff -u -r1.81 cmLocalVisualStudio7Generator.cxx --- Source/cmLocalVisualStudio7Generator.cxx 16 Jun 2005 15:48:42 -0000 1.81 +++ Source/cmLocalVisualStudio7Generator.cxx 23 Jun 2005 06:17:16 -0000 @@ -724,7 +724,10 @@ this->OutputLibraries(fout, configName, libName, target); fout << "\"\n"; temp = m_ExecutableOutputPath; - temp += configName; + + if (!m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH_OVERRIDE")) + temp += configName; + temp += "/"; // do we have a different executable name? @@ -736,6 +739,9 @@ { temp += libName; } + + temp += debugPostfix; + temp += ".exe"; fout << "\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; for(std::map<cmStdString, cmStdString>::iterator i = flagMap.begin(); @@ -988,15 +994,32 @@ // Loop through every source group. - for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); - sg != sourceGroups.end(); ++sg) - { - const std::vector<const cmSourceFile *> &sourceFiles = +// for(std::vector<cmSourceGroup>::const_iterator sg = sourceGroups.begin(); + // sg != sourceGroups.end(); ++sg) + // { + + for(int i = 0; i < sourceGroups.size(); ++i) + { + cmSourceGroup sg = sourceGroups[i]; + WriteGroup(&sg, target, fout, libName, configs); + } + + //} + + fout << "\t</Files>\n"; + + // Write the VCProj file's footer. + this->WriteVCProjFooter(fout); +} + +void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs) +{ + const std::vector<const cmSourceFile *> &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. if(sourceFiles.empty()) { - continue; + return; } // If the group has a name, write the header. @@ -1104,19 +1127,18 @@ fout << "\t\t\t</File>\n"; } } - - // If the group has a name, write the footer. + + std::vector<cmSourceGroup> children = sg->GetGroupChildren(); + + for(int i=0;i<children.size();++i) + WriteGroup(&children[i], target, fout, libName, configs); + + // If the group has a name, write the footer. if(name != "") { this->WriteVCProjEndGroup(fout); } - } - fout << "\t</Files>\n"; - - // Write the VCProj file's footer. - this->WriteVCProjFooter(fout); -} - +} void cmLocalVisualStudio7Generator:: WriteCustomRule(std::ostream& fout, Index: Source/cmLocalVisualStudio7Generator.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v retrieving revision 1.11 diff -u -r1.11 cmLocalVisualStudio7Generator.h --- Source/cmLocalVisualStudio7Generator.h 18 Mar 2005 15:41:41 -0000 1.11 +++ Source/cmLocalVisualStudio7Generator.h 22 Jun 2005 11:09:22 -0000 @@ -116,6 +116,8 @@ const char* output, const char* extraFlags); + void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector<std::string> *configs); + std::vector<std::string> m_CreatedProjectNames; std::string m_LibraryOutputPath; std::string m_ExecutableOutputPath; Index: Source/cmMakefile.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v retrieving revision 1.297 diff -u -r1.297 cmMakefile.cxx --- Source/cmMakefile.cxx 20 Jun 2005 20:24:37 -0000 1.297 +++ Source/cmMakefile.cxx 22 Jun 2005 08:45:36 -0000 @@ -1223,31 +1223,87 @@ if(sgName == name) { return &(*sg); - } + } + else + { + cmSourceGroup *target = sg->lookupChild(name); + + if(target) + return target; + } } return 0; } -void cmMakefile::AddSourceGroup(const char* name, const char* regex) +void cmMakefile::AddSourceGroup(const char* name, const char* regex, const char *parent) { - // First see if the group exists. If so, replace its regular expression. - for(std::vector<cmSourceGroup>::iterator sg = m_SourceGroups.begin(); - sg != m_SourceGroups.end(); ++sg) + // First see if the group exists. If so, replace its regular expression. + for(int i=0;i<m_SourceGroups.size();++i) { - std::string sgName = sg->GetName(); - if(sgName == name) - { - if ( regex ) - { - // We only want to set the regular expression. If there are already - // source files in the group, we don't want to remove them. - sg->SetGroupRegex(regex); - } - return; - } - } - - // The group doesn't exist. Add it. + cmSourceGroup *sg = &m_SourceGroups[i]; + + std::string sgName = sg->GetName(); + if(!parent) + { + if(sgName == name) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + sg->SetGroupRegex(regex); + } + return; + } + } + else + { + if(sgName == parent) + { + cmSourceGroup *localtarget = sg->lookupChild(name); + if(localtarget) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + localtarget->SetGroupRegex(regex); + } + } + else + { + sg->AddChild(cmSourceGroup(name, regex)); + } + return; + } + else + { + cmSourceGroup *localtarget = sg->lookupChild(parent); + + if(localtarget) + { + cmSourceGroup *addtarget = localtarget->lookupChild(name); + + if(addtarget) + { + if ( regex ) + { + // We only want to set the regular expression. If there are already + // source files in the group, we don't want to remove them. + addtarget->SetGroupRegex(regex); + } + } + else + { + localtarget->AddChild(cmSourceGroup(name, regex)); + } + return; + } + } + } + } + + // The group doesn't exist. Add it. m_SourceGroups.push_back(cmSourceGroup(name, regex)); } @@ -1692,22 +1748,25 @@ for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); sg != groups.rend(); ++sg) { - if(sg->MatchesFiles(source)) - { - return *sg; - } + cmSourceGroup *result = sg->MatchChildrenFiles(source); + if(result) + { + return *result; + } } // Now search for a group whose regex matches the file. for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); sg != groups.rend(); ++sg) { - if(sg->MatchesRegex(source)) - { - return *sg; - } + cmSourceGroup *result = sg->MatchChildrenRegex(source); + if(result) + { + return *result; + } } - + + // Shouldn't get here, but just in case, return the default group. return groups.front(); } Index: Source/cmMakefile.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v retrieving revision 1.166 diff -u -r1.166 cmMakefile.h --- Source/cmMakefile.h 17 Jun 2005 19:50:08 -0000 1.166 +++ Source/cmMakefile.h 22 Jun 2005 08:45:36 -0000 @@ -280,7 +280,7 @@ /** * Add a source group for consideration when adding a new source. */ - void AddSourceGroup(const char* name, const char* regex=0); + void AddSourceGroup(const char* name, const char* regex=0, const char* parent=0); /** * Add an auxiliary directory to the build. Index: Source/cmSourceGroup.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroup.cxx,v retrieving revision 1.16 diff -u -r1.16 cmSourceGroup.cxx --- Source/cmSourceGroup.cxx 23 Jul 2003 19:32:54 -0000 1.16 +++ Source/cmSourceGroup.cxx 3 Mar 2005 15:01:10 -0000 @@ -81,3 +81,95 @@ { return m_SourceFiles; } + +//---------------------------------------------------------------------------- +void cmSourceGroup::AddChild(cmSourceGroup child) +{ + m_GroupChildren.push_back(child); +} + +//---------------------------------------------------------------------------- +cmSourceGroup *cmSourceGroup::lookupChild(const char* name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + // st + for(; + iter!=end; + ++iter) + { + std::string sgName = iter->GetName(); + + // look if descenened is the one were looking for + if(sgName == name) + return &(*iter); // if it so return it + + // if the descendend isn't the one where looking for ask it's traverse + cmSourceGroup *result = iter->lookupChild(name); + + // if one of it's descendeds is the one we're looking for return it + if(result) + return result; + } + + // if no child with this name was found return NULL + return NULL; +} + +cmSourceGroup *cmSourceGroup::MatchChildrenFiles(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesFiles(name)) + return this; + + + // st + for(; + iter!=end; + ++iter) + { + + cmSourceGroup *result = iter->MatchChildrenFiles(name); + + if(result) + return result; + } + + return NULL; +} + + +cmSourceGroup *cmSourceGroup::MatchChildrenRegex(const char *name) +{ + // initializing iterators + std::vector<cmSourceGroup>::iterator iter = m_GroupChildren.begin(); + std::vector<cmSourceGroup>::iterator end = m_GroupChildren.end(); + + if(this->MatchesRegex(name)) + return this; + + + // st + for(; + iter!=end; + ++iter) + { + + cmSourceGroup *result = iter->MatchChildrenRegex(name); + + if(result) + return result; + } + + return NULL; +} + +std::vector<cmSourceGroup> cmSourceGroup::GetGroupChildren() const +{ + return m_GroupChildren; +} Index: Source/cmSourceGroup.h =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroup.h,v retrieving revision 1.16 diff -u -r1.16 cmSourceGroup.h --- Source/cmSourceGroup.h 23 Jul 2003 19:32:54 -0000 1.16 +++ Source/cmSourceGroup.h 2 Mar 2005 14:01:14 -0000 @@ -47,6 +47,16 @@ * Add a file name to the explicit list of files for this group. */ void AddGroupFile(const char* name); + + /** + * Add child to this sourcegroup + */ + void AddChild(cmSourceGroup child); + + /** + * Looks up child and returns it + */ + cmSourceGroup *lookupChild(const char *name); /** * Get the name of this group. @@ -62,6 +72,16 @@ * Check if the given name matches this group's explicit file list. */ bool MatchesFiles(const char* name); + + /** + * Check if the given name matches this group's explicit file list in children. + */ + cmSourceGroup *MatchChildrenFiles(const char *name); + + /** + * Check if the given name matches this group's regex in children. + */ + cmSourceGroup *MatchChildrenRegex(const char *name); /** * Assign the given source file to this group. Used only by @@ -76,6 +96,7 @@ const std::vector<const cmSourceFile*>& GetSourceFiles() const; std::vector<const cmSourceFile*>& GetSourceFiles(); + std::vector<cmSourceGroup> GetGroupChildren() const; private: /** * The name of the source group. @@ -97,6 +118,8 @@ * this group. */ std::vector<const cmSourceFile*> m_SourceFiles; + + std::vector<cmSourceGroup> m_GroupChildren; }; #endif Index: Source/cmSourceGroupCommand.cxx =================================================================== RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroupCommand.cxx,v retrieving revision 1.11 diff -u -r1.11 cmSourceGroupCommand.cxx --- Source/cmSourceGroupCommand.cxx 28 Jul 2003 18:43:04 -0000 1.11 +++ Source/cmSourceGroupCommand.cxx 22 Jun 2005 14:41:36 -0000 @@ -16,6 +16,30 @@ =========================================================================*/ #include "cmSourceGroupCommand.h" +std::vector<std::string> tokenize(const std::string& str,const std::string& sep, bool skipEmptyTokens) throw() +{ + std::vector<std::string> tokens; + std::string::size_type tokstart,tokend; + + if (skipEmptyTokens) tokend=0; + else tokend=std::string::npos; + + do + { + if (skipEmptyTokens) tokstart=str.find_first_not_of(sep,tokend); + else tokstart=tokend+1; + + if (tokstart==std::string::npos) break; // no more tokens + tokend=str.find_first_of(sep,tokstart); + if (tokend==std::string::npos) + tokens.push_back(str.substr(tokstart)); + else + tokens.push_back(str.substr(tokstart,tokend-tokstart)); + } while (tokend!=std::string::npos); + + return tokens; +} + // cmSourceGroupCommand bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args) { @@ -24,18 +48,33 @@ this->SetError("called with incorrect number of arguments"); return false; } - - // Get the source group with the given name. - cmSourceGroup* sg = m_Makefile->GetSourceGroup(args[0].c_str()); - if(!sg) - { - m_Makefile->AddSourceGroup(args[0].c_str(), 0); - sg = m_Makefile->GetSourceGroup(args[0].c_str()); - } - + + std::string delimiter = "\\"; + + if(m_Makefile->GetDefinition("SOURCE_GROUP_DELIMITER")) + delimiter = m_Makefile->GetDefinition("SOURCE_GROUP_DELIMITER"); + + std::vector<std::string> folders = tokenize(args[0], delimiter, true); + + const char *parent = NULL; + + cmSourceGroup* sg = NULL; + + for(int i=0;i<folders.size();++i) + { + sg = m_Makefile->GetSourceGroup(folders[i].c_str()); + + if(!sg) + m_Makefile->AddSourceGroup(folders[i].c_str(), 0, parent); + + sg = m_Makefile->GetSourceGroup(folders[i].c_str()); + + parent = folders[i].c_str(); + } + // If only two arguments are given, the pre-1.8 version of the // command is being invoked. - if(args.size() == 2 && args[1] != "FILES") + if(args.size() == 2 && args[1] != "FILES") { sg->SetGroupRegex(args[1].c_str()); return true; | ||||||||
Relationships | |
Relationships |
Notes | |
(0002544) Michael Seydl (reporter) 2005-06-23 04:49 |
added a new patch (v2) which includes debugpostfixes for executable in case that u override the path and put debug and release executable in the same directory |
(0002645) Bill Hoffman (manager) 2005-07-13 10:06 |
Hi, can you send me some examples of this stuff so we can add test cases? |
(0002647) Bill Hoffman (manager) 2005-07-13 11:23 |
I have commited the patch to cvs, please try it and make sure it works as expected. |
(0007648) Christopher Lux (reporter) 2007-05-15 03:21 |
this patch is broken, i do not know why it has not come up yet. here the followup bugs: http://www.cmake.org/Bug/bug.php?op=show&bugid=2331&pos=1 [^] http://www.cmake.org/Bug/bug.php?op=show&bugid=4637&pos=1 [^] i sent an email to bill hoffman with the locations of the bug, i hope he will fix it... |
(0008652) Alex Neundorf (developer) 2007-08-24 11:07 |
Duplicate of 0004057, more comments please over there. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2007-08-24 11:07 | Alex Neundorf | Note Added: 0008652 | |
2007-08-24 11:07 | Alex Neundorf | Assigned To | Bill Hoffman => Alex Neundorf |
2007-08-24 11:07 | Alex Neundorf | Status | new => closed |
2007-08-24 11:07 | Alex Neundorf | Resolution | reopened => duplicate |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |