Ok heres a new patch using '-f' as the option! -Martin Lütken
-----Original Message----- From: [EMAIL PROTECTED] on behalf of Brandon Van Every Sent: Sun 1/13/2008 6:57 PM To: cmake@cmake.org Subject: Re: [CMake] Patch to apply! Changing the default name"CMakeLists.txt"! On Jan 13, 2008 12:13 PM, Martin Lütken <[EMAIL PROTECTED]> wrote: > > It's a long time since I said I might do this feature. But with the > supplied > patch it's now possible to use the option '--cmakelists-file-name' to > specify > another filename to look for instead of 'CMakeLists.txt'. Is a short form single letter version of this command also available? I would recommend -f as it's parallel with Make. I also think --cmakelists-file-name is excessively verbose. --file would be sufficient, although you could retain the longer name also. Here's what Make does: -f FILE, --file=FILE, --makefile=FILE Read FILE as a makefile. I think it's important to respect these nuances / niceties / conventions for command line options. CMake is not a terribly command line oriented tool, but there's a lot of command line oriented people out there that we'd like to convert to CMake. So it would be good if we give them the kinds of things they expect, to the degree that it's easy for us to do so. I think in this case -f is quite easy. Cheers, Brandon Van Every _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
diff -cr CMake/Source/cmake.cxx CMakeNew/Source/cmake.cxx *** CMake/Source/cmake.cxx 2008-01-03 13:28:12.000000000 +0100 --- CMakeNew/Source/cmake.cxx 2008-01-13 17:25:32.000000000 +0100 *************** *** 110,115 **** --- 110,117 ---- #include <memory> // auto_ptr + const char* cmake::CMAKELISTS_FILE_NAME = "CMakeLists.txt"; + static bool cmakeCheckStampFile(const char* stampName); void cmNeedBackwardsCompatibility(const std::string& variable, *************** *** 644,650 **** std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; std::string listFile = path; ! listFile += "/CMakeLists.txt"; if(cmSystemTools::FileExists(cacheFile.c_str())) { cachePath = path; --- 646,652 ---- std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; std::string listFile = path; ! listFile += std::string("/") + cmake::CMAKELISTS_FILE_NAME; if(cmSystemTools::FileExists(cacheFile.c_str())) { cachePath = path; *************** *** 1723,1736 **** { // Make sure the Start directory contains a CMakeLists.txt file. std::string srcList = this->GetHomeDirectory(); ! srcList += "/CMakeLists.txt"; if(!cmSystemTools::FileExists(srcList.c_str())) { cmOStringStream err; if(cmSystemTools::FileIsDirectory(this->GetHomeDirectory())) { err << "The source directory \"" << this->GetHomeDirectory() ! << "\" does not appear to contain CMakeLists.txt.\n"; } else if(cmSystemTools::FileExists(this->GetHomeDirectory())) { --- 1725,1738 ---- { // Make sure the Start directory contains a CMakeLists.txt file. std::string srcList = this->GetHomeDirectory(); ! srcList += std::string("/") + cmake::CMAKELISTS_FILE_NAME; if(!cmSystemTools::FileExists(srcList.c_str())) { cmOStringStream err; if(cmSystemTools::FileIsDirectory(this->GetHomeDirectory())) { err << "The source directory \"" << this->GetHomeDirectory() ! << "\" does not appear to contain " << cmake::CMAKELISTS_FILE_NAME << "\n"; } else if(cmSystemTools::FileExists(this->GetHomeDirectory())) { *************** *** 1753,1761 **** { std::string cacheStart = this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); ! cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); ! currentStart += "/CMakeLists.txt"; if(!cmSystemTools::SameFile(cacheStart.c_str(), currentStart.c_str())) { std::string message = "The source \""; --- 1755,1763 ---- { std::string cacheStart = this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"); ! cacheStart += std::string("/") + cmake::CMAKELISTS_FILE_NAME; std::string currentStart = this->GetHomeDirectory(); ! currentStart += std::string("/") + cmake::CMAKELISTS_FILE_NAME; if(!cmSystemTools::SameFile(cacheStart.c_str(), currentStart.c_str())) { std::string message = "The source \""; *************** *** 3533,3539 **** std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; std::string outFile = destPath; ! outFile += "/CMakeLists.txt"; // Copy file if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) --- 3535,3541 ---- std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; std::string outFile = destPath; ! outFile += std::string("/") + cmake::CMAKELISTS_FILE_NAME; // Copy file if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) diff -cr CMake/Source/cmake.h CMakeNew/Source/cmake.h *** CMake/Source/cmake.h 2008-01-01 21:13:41.000000000 +0100 --- CMakeNew/Source/cmake.h 2008-01-13 17:10:29.000000000 +0100 *************** *** 59,64 **** --- 59,66 ---- public: typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap; + static const char* CMAKELISTS_FILE_NAME; ///< The actual name used as "CMakeLists.txt" + ///! construct an instance of cmake cmake(); ///! destruct an instance of cmake diff -cr CMake/Source/cmakemain.cxx CMakeNew/Source/cmakemain.cxx *** CMake/Source/cmakemain.cxx 2007-12-13 23:56:49.000000000 +0100 --- CMakeNew/Source/cmakemain.cxx 2008-01-13 19:54:13.000000000 +0100 *************** *** 88,93 **** --- 88,96 ---- "No configure or generate step is performed and the cache is not" " modified. If variables are defined using -D, this must be done " "before the -P argument."}, + {"-f [FILE]", "Read FILE(name) as a makefile instead of 'CMakeLists.txt'.", + "CMake will look for this filename in all source directories instead of the " + "default 'CMakeLists.txt'."}, {"--graphviz=[file]", "Generate graphviz of dependencies.", "Generate a graphviz input file that will contain all the library and " "executable dependencies in the project."}, *************** *** 417,422 **** --- 420,443 ---- list_all_cached = true; list_help = true; } + // TODO: [EMAIL PROTECTED]: This it not a perfect way to do this, but I am not sure + // where to put processing of this new argument. Also if you specify + // fx. '-f -N' you will not get the intended error message. + else if (strcmp(av[i], "-f") == 0) + { + if ( i < ac -1 ) + { + i++; + cmake::CMAKELISTS_FILE_NAME = av[i]; + } + else + { + cmSystemTools::Error("No filename specified for argument -f"); + } + // TODO: Is this a good way and place to print this info out. And should we print it at all ? + std::string sMsg = std::string("Using CmakeLists filename: ") + cmake::CMAKELISTS_FILE_NAME; + cmSystemTools::Message( sMsg.c_str() ); + } else if (strncmp(av[i], "-P", strlen("-P")) == 0) { if ( i == ac -1 ) diff -cr CMake/Source/cmCoreTryCompile.cxx CMakeNew/Source/cmCoreTryCompile.cxx *** CMake/Source/cmCoreTryCompile.cxx 2007-12-06 15:56:02.000000000 +0100 --- CMakeNew/Source/cmCoreTryCompile.cxx 2008-01-13 17:16:50.000000000 +0100 *************** *** 148,154 **** return -1; } ! std::string outFileName = this->BinaryDirectory + "/CMakeLists.txt"; // which signature are we using? If we are using var srcfile bindir if (this->SrcFileSignature) { --- 148,154 ---- return -1; } ! std::string outFileName = this->BinaryDirectory + std::string("/") + cmake::CMAKELISTS_FILE_NAME; // which signature are we using? If we are using var srcfile bindir if (this->SrcFileSignature) { diff -cr CMake/Source/cmGlobalKdevelopGenerator.cxx CMakeNew/Source/cmGlobalKdevelopGenerator.cxx *** CMake/Source/cmGlobalKdevelopGenerator.cxx 2007-10-22 19:28:49.000000000 +0200 --- CMakeNew/Source/cmGlobalKdevelopGenerator.cxx 2008-01-13 17:14:10.000000000 +0100 *************** *** 148,154 **** tmp=cmSystemTools::GetFilenameName(tmp); //add all files which dont match the default // */CMakeLists.txt;*cmake; to the file pattern ! if ((tmp!="CMakeLists.txt") && (strstr(tmp.c_str(), ".cmake")==0)) { cmakeFilePattern+=tmp+";"; --- 148,154 ---- tmp=cmSystemTools::GetFilenameName(tmp); //add all files which dont match the default // */CMakeLists.txt;*cmake; to the file pattern ! if ((tmp!=cmake::CMAKELISTS_FILE_NAME) && (strstr(tmp.c_str(), ".cmake")==0)) { cmakeFilePattern+=tmp+";"; diff -cr CMake/Source/cmLocalGenerator.cxx CMakeNew/Source/cmLocalGenerator.cxx *** CMake/Source/cmLocalGenerator.cxx 2008-01-11 19:00:29.000000000 +0100 --- CMakeNew/Source/cmLocalGenerator.cxx 2008-01-13 17:16:47.000000000 +0100 *************** *** 78,84 **** // find & read the list file std::string currentStart = this->Makefile->GetStartDirectory(); ! currentStart += "/CMakeLists.txt"; this->Makefile->ReadListFile(currentStart.c_str()); // at the end of the ReadListFile handle any old style subdirs --- 78,84 ---- // find & read the list file std::string currentStart = this->Makefile->GetStartDirectory(); ! currentStart += std::string("/") + cmake::CMAKELISTS_FILE_NAME; this->Makefile->ReadListFile(currentStart.c_str()); // at the end of the ReadListFile handle any old style subdirs diff -cr CMake/Source/cmLocalVisualStudio6Generator.cxx CMakeNew/Source/cmLocalVisualStudio6Generator.cxx *** CMake/Source/cmLocalVisualStudio6Generator.cxx 2007-11-20 17:18:04.000000000 +0100 --- CMakeNew/Source/cmLocalVisualStudio6Generator.cxx 2008-01-13 17:14:12.000000000 +0100 *************** *** 203,209 **** commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); makefileIn += "/"; ! makefileIn += "CMakeLists.txt"; std::string comment = "Building Custom Rule "; comment += makefileIn; std::string args; --- 203,209 ---- commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); makefileIn += "/"; ! makefileIn += cmake::CMAKELISTS_FILE_NAME; std::string comment = "Building Custom Rule "; comment += makefileIn; std::string args; diff -cr CMake/Source/cmLocalVisualStudio7Generator.cxx CMakeNew/Source/cmLocalVisualStudio7Generator.cxx *** CMake/Source/cmLocalVisualStudio7Generator.cxx 2007-12-18 15:50:08.000000000 +0100 --- CMakeNew/Source/cmLocalVisualStudio7Generator.cxx 2008-01-13 17:14:13.000000000 +0100 *************** *** 216,222 **** commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); makefileIn += "/"; ! makefileIn += "CMakeLists.txt"; makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str()); std::string comment = "Building Custom Rule "; comment += makefileIn; --- 216,222 ---- commandLine.push_back(dsprule); std::string makefileIn = this->Makefile->GetStartDirectory(); makefileIn += "/"; ! makefileIn += cmake::CMAKELISTS_FILE_NAME; makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str()); std::string comment = "Building Custom Rule "; comment += makefileIn; diff -cr CMake/Source/MFCDialog/CMakeSetupDialog.cpp CMakeNew/Source/MFCDialog/CMakeSetupDialog.cpp *** CMake/Source/MFCDialog/CMakeSetupDialog.cpp 2007-08-01 20:58:55.000000000 +0200 --- CMakeNew/Source/MFCDialog/CMakeSetupDialog.cpp 2008-01-13 17:16:49.000000000 +0100 *************** *** 1415,1421 **** std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; std::string listFile = path; ! listFile += "/CMakeLists.txt"; if(cmSystemTools::FileExists(cacheFile.c_str())) { cachePath = path; --- 1415,1421 ---- std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; std::string listFile = path; ! listFile += std::string("/") + cmake::CMAKELISTS_FILE_NAME; if(cmSystemTools::FileExists(cacheFile.c_str())) { cachePath = path; diff -cr CMake/Source/QtDialog/CMakeSetup.cxx CMakeNew/Source/QtDialog/CMakeSetup.cxx *** CMake/Source/QtDialog/CMakeSetup.cxx 2007-12-13 23:56:50.000000000 +0100 --- CMakeNew/Source/QtDialog/CMakeSetup.cxx 2008-01-13 17:14:15.000000000 +0100 *************** *** 107,113 **** if(args.count() == 2) { QFileInfo buildFileInfo(args[1], "CMakeCache.txt"); ! QFileInfo srcFileInfo(args[1], "CMakeLists.txt"); if(buildFileInfo.exists()) { dialog.setBinaryDirectory(buildFileInfo.absolutePath()); --- 107,113 ---- if(args.count() == 2) { QFileInfo buildFileInfo(args[1], "CMakeCache.txt"); ! QFileInfo srcFileInfo(args[1], cmake::CMAKELISTS_FILE_NAME); if(buildFileInfo.exists()) { dialog.setBinaryDirectory(buildFileInfo.absolutePath()); diff -cr CMake/Source/QtDialog/CMakeSetupDialog.cxx CMakeNew/Source/QtDialog/CMakeSetupDialog.cxx *** CMake/Source/QtDialog/CMakeSetupDialog.cxx 2007-12-12 19:25:24.000000000 +0100 --- CMakeNew/Source/QtDialog/CMakeSetupDialog.cxx 2008-01-13 17:14:14.000000000 +0100 *************** *** 592,598 **** QString file = urls.count() ? urls[0].toLocalFile() : QString(); if(!file.isEmpty() && (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) || ! file.endsWith("CMakeLists.txt", Qt::CaseInsensitive) ) ) { e->accept(); } --- 592,598 ---- QString file = urls.count() ? urls[0].toLocalFile() : QString(); if(!file.isEmpty() && (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) || ! file.endsWith(cmake::CMAKELISTS_FILE_NAME, Qt::CaseInsensitive) ) ) { e->accept(); } *************** *** 621,627 **** this->setBinaryDirectory(info.absolutePath()); } } ! else if(file.endsWith("CMakeLists.txt", Qt::CaseInsensitive)) { QFileInfo info(file); if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath()) --- 621,627 ---- this->setBinaryDirectory(info.absolutePath()); } } ! else if(file.endsWith(cmake::CMAKELISTS_FILE_NAME, Qt::CaseInsensitive)) { QFileInfo info(file); if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath())
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake