diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-01 13:28:39 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-03-01 13:28:39 (GMT) |
commit | 07260a6f271e73f5c46f6accee1e629499afa5de (patch) | |
tree | df01c41bd8d7b428ac3e0f5d40847954874fcead | |
parent | d231a422ed888acf774ff251a640e092957ec844 (diff) | |
download | CMake-07260a6f271e73f5c46f6accee1e629499afa5de.zip CMake-07260a6f271e73f5c46f6accee1e629499afa5de.tar.gz CMake-07260a6f271e73f5c46f6accee1e629499afa5de.tar.bz2 |
ENH: Cleanup global targets even more and potentially fix Xcode
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 98 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 8 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 38 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 3 |
5 files changed, 61 insertions, 89 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dccc568..b30d976 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1214,6 +1214,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { cmMakefile* mf = m_LocalGenerators[0]->GetMakefile(); const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory(); + const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); // CPack cmCustomCommandLines cpackCommandLines; @@ -1233,7 +1234,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) configFile += "/CPackConfig.cmake"; singleLine.push_back(configFile); cpackCommandLines.push_back(singleLine); - if ( this->GetPreInstallAvailable() ) + if ( this->GetPreinstallTargetName() ) { depends.push_back("preinstall"); } @@ -1256,58 +1257,74 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) } //Edit Cache - cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); - singleLine.erase(singleLine.begin(), singleLine.end()); - depends.erase(depends.begin(), depends.end()); - - const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); - // Use CMAKE_EDIT_COMMAND for the edit_cache rule if it is defined. - // Otherwise default to the interactive command-line interface. - if(mf->GetDefinition("CMAKE_EDIT_COMMAND")) + const char* editCacheTargetName = this->GetEditCacheTargetName(); + if ( editCacheTargetName ) { - singleLine.push_back(mf->GetDefinition("CMAKE_EDIT_COMMAND")); - singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); - singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); - cpackCommandLines.push_back(singleLine); - (*targets)[this->GetEditCacheTargetName()] = - this->CreateGlobalTarget( - this->GetEditCacheTargetName(), "Running CMake cache editor...", - &cpackCommandLines, depends); + cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); + singleLine.erase(singleLine.begin(), singleLine.end()); + depends.erase(depends.begin(), depends.end()); + + // Use CMAKE_EDIT_COMMAND for the edit_cache rule if it is defined. + // Otherwise default to the interactive command-line interface. + if(mf->GetDefinition("CMAKE_EDIT_COMMAND")) + { + singleLine.push_back(mf->GetDefinition("CMAKE_EDIT_COMMAND")); + singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); + singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); + cpackCommandLines.push_back(singleLine); + (*targets)[editCacheTargetName] = + this->CreateGlobalTarget( + editCacheTargetName, "Running CMake cache editor...", + &cpackCommandLines, depends); + } + else + { + singleLine.push_back(cmakeCommand); + singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); + singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); + singleLine.push_back("-i"); + cpackCommandLines.push_back(singleLine); + (*targets)[editCacheTargetName] = + this->CreateGlobalTarget( + editCacheTargetName, "Running interactive CMake command-line interface...", + &cpackCommandLines, depends); + } } - else + + //Rebuild Cache + const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName(); + if ( rebuildCacheTargetName ) { + cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); + singleLine.erase(singleLine.begin(), singleLine.end()); + depends.erase(depends.begin(), depends.end()); singleLine.push_back(cmakeCommand); singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); - singleLine.push_back("-i"); cpackCommandLines.push_back(singleLine); - (*targets)[this->GetEditCacheTargetName()] = + (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( - this->GetEditCacheTargetName(), "Running interactive CMake command-line interface...", + rebuildCacheTargetName, "Running CMake to regenerate build system...", &cpackCommandLines, depends); } - //Rebuild Cache - cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); - singleLine.erase(singleLine.begin(), singleLine.end()); - depends.erase(depends.begin(), depends.end()); - singleLine.push_back(cmakeCommand); - singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); - singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); - cpackCommandLines.push_back(singleLine); - (*targets)[this->GetRebuildCacheTargetName()] = - this->CreateGlobalTarget( - this->GetRebuildCacheTargetName(), "Running CMake to regenerate build system...", - &cpackCommandLines, depends); - //Install std::string cmd; cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); singleLine.erase(singleLine.begin(), singleLine.end()); depends.erase(depends.begin(), depends.end()); - if ( this->GetPreInstallAvailable() ) + if ( this->GetPreinstallTargetName() ) { - depends.push_back("preinstall"); + depends.push_back(this->GetPreinstallTargetName()); + } + else + { + const char* noall = + mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); + if(!noall || cmSystemTools::IsOff(noall)) + { + depends.push_back(this->GetAllTargetName()); + } } if(mf->GetDefinition("CMake_BINARY_DIR")) { @@ -1330,15 +1347,6 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-P"); singleLine.push_back("cmake_install.cmake"); cpackCommandLines.push_back(singleLine); - /* - const char* noall = - mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); - bool dependsOnAll = false; - if(!noall || cmSystemTools::IsOff(noall)) - { - dependsOnAll = true; - } - */ (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( this->GetInstallTargetName(), "Install the project...", diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5864738..acc5095 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -171,13 +171,13 @@ protected: const cmCustomCommandLines* commandLines, std::vector<std::string> depends, bool depends_on_all = false); + virtual const char* GetAllTargetName() { return "ALL_BUILD"; } virtual const char* GetInstallTargetName() { return "INSTALL"; } - virtual const char* GetPreinstallTargetName() { return "PREINSTALL"; } + virtual const char* GetPreinstallTargetName() { return 0; } virtual const char* GetTestTargetName() { return "RUN_TESTS"; } virtual const char* GetPackageTargetName() { return "PACKAGE"; } - virtual const char* GetEditCacheTargetName() { return "EDIT_CACHE"; } - virtual const char* GetRebuildCacheTargetName() { return "REBUILD_CACHE"; } - virtual bool GetPreInstallAvailable() { return false; } + virtual const char* GetEditCacheTargetName() { return 0; } + virtual const char* GetRebuildCacheTargetName() { return 0; } bool m_ForceUnixPaths; cmStdString m_FindMakeProgramFile; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index fd232d2..23ad6f1 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -120,14 +120,13 @@ protected: bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg, const char *); // Setup target names + virtual const char* GetAllTargetName() { return "all"; } virtual const char* GetInstallTargetName() { return "install"; } virtual const char* GetPreinstallTargetName() { return "preinstall"; } virtual const char* GetTestTargetName() { return "test"; } virtual const char* GetPackageTargetName() { return "package"; } virtual const char* GetEditCacheTargetName() { return "edit_cache"; } virtual const char* GetRebuildCacheTargetName() { return "rebuild_cache"; } - virtual bool GetPreInstallAvailable() { return true; } - // Some make programs (Borland) do not keep a rule if there are no // dependencies or commands. This is a problem for creating rules diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d7736a4..cf9a6f2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -283,45 +283,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, no_working_directory, "echo", "Build all projects"); cmTarget* allbuild = mf->FindTarget("ALL_BUILD"); - // ADD install - std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); - if(m_XcodeVersion == 15) - { - mf->AddUtilityCommand("install", false, no_output, no_depends, - no_working_directory, - cmake_command.c_str(), - "-P", "cmake_install.cmake"); - } - else - { - mf->AddUtilityCommand("install", false, no_output, no_depends, - no_working_directory, - cmake_command.c_str(), - "-DBUILD_TYPE=$(CONFIGURATION)", - "-P", "cmake_install.cmake"); - } - const char* noall = - mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); - if(!noall || cmSystemTools::IsOff(noall)) - { - cmTarget* install = mf->FindTarget("install"); - install->AddUtility("ALL_BUILD"); - } - - // Add RUN_TESTS target if testing has been enabled - std::string fname; - fname = mf->GetStartOutputDirectory(); - fname += "/"; - fname += "DartTestfile.txt"; - if (cmSystemTools::FileExists(fname.c_str())) - { - std::string ctest_command = - mf->GetRequiredDefinition("CMAKE_CTEST_COMMAND"); - mf->AddUtilityCommand("RUN_TESTS", false, no_output, no_depends, - no_working_directory, - ctest_command.c_str()); - } // Add XCODE depend helper std::string dir = mf->GetCurrentOutputDirectory(); m_CurrentXCodeHackMakefile = dir; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index d73639b..cc6a39a 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -151,6 +151,9 @@ private: const char* varNameSuffix, const char* default_flags); protected: + virtual const char* GetInstallTargetName() { return "install"; } + virtual const char* GetPackageTargetName() { return "package"; } + int m_XcodeVersion; std::vector<cmXCodeObject*> m_XCodeObjects; cmXCodeObject* m_RootObject; |