ENH: Cleanup global targets even more and potentially fix Xcode
This commit is contained in:
parent
d231a422ed
commit
07260a6f27
|
@ -1214,6 +1214,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
|
||||||
{
|
{
|
||||||
cmMakefile* mf = m_LocalGenerators[0]->GetMakefile();
|
cmMakefile* mf = m_LocalGenerators[0]->GetMakefile();
|
||||||
const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory();
|
const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory();
|
||||||
|
const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND");
|
||||||
|
|
||||||
// CPack
|
// CPack
|
||||||
cmCustomCommandLines cpackCommandLines;
|
cmCustomCommandLines cpackCommandLines;
|
||||||
|
@ -1233,7 +1234,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
|
||||||
configFile += "/CPackConfig.cmake";
|
configFile += "/CPackConfig.cmake";
|
||||||
singleLine.push_back(configFile);
|
singleLine.push_back(configFile);
|
||||||
cpackCommandLines.push_back(singleLine);
|
cpackCommandLines.push_back(singleLine);
|
||||||
if ( this->GetPreInstallAvailable() )
|
if ( this->GetPreinstallTargetName() )
|
||||||
{
|
{
|
||||||
depends.push_back("preinstall");
|
depends.push_back("preinstall");
|
||||||
}
|
}
|
||||||
|
@ -1256,58 +1257,74 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Edit Cache
|
//Edit Cache
|
||||||
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
|
const char* editCacheTargetName = this->GetEditCacheTargetName();
|
||||||
singleLine.erase(singleLine.begin(), singleLine.end());
|
if ( editCacheTargetName )
|
||||||
depends.erase(depends.begin(), depends.end());
|
{
|
||||||
|
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.
|
||||||
// Use CMAKE_EDIT_COMMAND for the edit_cache rule if it is defined.
|
// Otherwise default to the interactive command-line interface.
|
||||||
// Otherwise default to the interactive command-line interface.
|
if(mf->GetDefinition("CMAKE_EDIT_COMMAND"))
|
||||||
if(mf->GetDefinition("CMAKE_EDIT_COMMAND"))
|
{
|
||||||
{
|
singleLine.push_back(mf->GetDefinition("CMAKE_EDIT_COMMAND"));
|
||||||
singleLine.push_back(mf->GetDefinition("CMAKE_EDIT_COMMAND"));
|
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
||||||
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
||||||
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
cpackCommandLines.push_back(singleLine);
|
||||||
cpackCommandLines.push_back(singleLine);
|
(*targets)[editCacheTargetName] =
|
||||||
(*targets)[this->GetEditCacheTargetName()] =
|
this->CreateGlobalTarget(
|
||||||
this->CreateGlobalTarget(
|
editCacheTargetName, "Running CMake cache editor...",
|
||||||
this->GetEditCacheTargetName(), "Running CMake cache editor...",
|
&cpackCommandLines, depends);
|
||||||
&cpackCommandLines, depends);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
singleLine.push_back(cmakeCommand);
|
||||||
singleLine.push_back(cmakeCommand);
|
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
||||||
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
||||||
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
singleLine.push_back("-i");
|
||||||
singleLine.push_back("-i");
|
cpackCommandLines.push_back(singleLine);
|
||||||
cpackCommandLines.push_back(singleLine);
|
(*targets)[editCacheTargetName] =
|
||||||
(*targets)[this->GetEditCacheTargetName()] =
|
this->CreateGlobalTarget(
|
||||||
this->CreateGlobalTarget(
|
editCacheTargetName, "Running interactive CMake command-line interface...",
|
||||||
this->GetEditCacheTargetName(), "Running interactive CMake command-line interface...",
|
&cpackCommandLines, depends);
|
||||||
&cpackCommandLines, depends);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rebuild Cache
|
//Rebuild Cache
|
||||||
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
|
const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName();
|
||||||
singleLine.erase(singleLine.begin(), singleLine.end());
|
if ( rebuildCacheTargetName )
|
||||||
depends.erase(depends.begin(), depends.end());
|
{
|
||||||
singleLine.push_back(cmakeCommand);
|
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
|
||||||
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
singleLine.erase(singleLine.begin(), singleLine.end());
|
||||||
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
depends.erase(depends.begin(), depends.end());
|
||||||
cpackCommandLines.push_back(singleLine);
|
singleLine.push_back(cmakeCommand);
|
||||||
(*targets)[this->GetRebuildCacheTargetName()] =
|
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
|
||||||
this->CreateGlobalTarget(
|
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
|
||||||
this->GetRebuildCacheTargetName(), "Running CMake to regenerate build system...",
|
cpackCommandLines.push_back(singleLine);
|
||||||
&cpackCommandLines, depends);
|
(*targets)[rebuildCacheTargetName] =
|
||||||
|
this->CreateGlobalTarget(
|
||||||
|
rebuildCacheTargetName, "Running CMake to regenerate build system...",
|
||||||
|
&cpackCommandLines, depends);
|
||||||
|
}
|
||||||
|
|
||||||
//Install
|
//Install
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
|
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
|
||||||
singleLine.erase(singleLine.begin(), singleLine.end());
|
singleLine.erase(singleLine.begin(), singleLine.end());
|
||||||
depends.erase(depends.begin(), depends.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"))
|
if(mf->GetDefinition("CMake_BINARY_DIR"))
|
||||||
{
|
{
|
||||||
|
@ -1330,15 +1347,6 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
|
||||||
singleLine.push_back("-P");
|
singleLine.push_back("-P");
|
||||||
singleLine.push_back("cmake_install.cmake");
|
singleLine.push_back("cmake_install.cmake");
|
||||||
cpackCommandLines.push_back(singleLine);
|
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()] =
|
(*targets)[this->GetInstallTargetName()] =
|
||||||
this->CreateGlobalTarget(
|
this->CreateGlobalTarget(
|
||||||
this->GetInstallTargetName(), "Install the project...",
|
this->GetInstallTargetName(), "Install the project...",
|
||||||
|
|
|
@ -171,13 +171,13 @@ protected:
|
||||||
const cmCustomCommandLines* commandLines,
|
const cmCustomCommandLines* commandLines,
|
||||||
std::vector<std::string> depends, bool depends_on_all = false);
|
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* 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* GetTestTargetName() { return "RUN_TESTS"; }
|
||||||
virtual const char* GetPackageTargetName() { return "PACKAGE"; }
|
virtual const char* GetPackageTargetName() { return "PACKAGE"; }
|
||||||
virtual const char* GetEditCacheTargetName() { return "EDIT_CACHE"; }
|
virtual const char* GetEditCacheTargetName() { return 0; }
|
||||||
virtual const char* GetRebuildCacheTargetName() { return "REBUILD_CACHE"; }
|
virtual const char* GetRebuildCacheTargetName() { return 0; }
|
||||||
virtual bool GetPreInstallAvailable() { return false; }
|
|
||||||
|
|
||||||
bool m_ForceUnixPaths;
|
bool m_ForceUnixPaths;
|
||||||
cmStdString m_FindMakeProgramFile;
|
cmStdString m_FindMakeProgramFile;
|
||||||
|
|
|
@ -120,14 +120,13 @@ protected:
|
||||||
bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg, const char *);
|
bool NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg, const char *);
|
||||||
|
|
||||||
// Setup target names
|
// Setup target names
|
||||||
|
virtual const char* GetAllTargetName() { return "all"; }
|
||||||
virtual const char* GetInstallTargetName() { return "install"; }
|
virtual const char* GetInstallTargetName() { return "install"; }
|
||||||
virtual const char* GetPreinstallTargetName() { return "preinstall"; }
|
virtual const char* GetPreinstallTargetName() { return "preinstall"; }
|
||||||
virtual const char* GetTestTargetName() { return "test"; }
|
virtual const char* GetTestTargetName() { return "test"; }
|
||||||
virtual const char* GetPackageTargetName() { return "package"; }
|
virtual const char* GetPackageTargetName() { return "package"; }
|
||||||
virtual const char* GetEditCacheTargetName() { return "edit_cache"; }
|
virtual const char* GetEditCacheTargetName() { return "edit_cache"; }
|
||||||
virtual const char* GetRebuildCacheTargetName() { return "rebuild_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
|
// Some make programs (Borland) do not keep a rule if there are no
|
||||||
// dependencies or commands. This is a problem for creating rules
|
// dependencies or commands. This is a problem for creating rules
|
||||||
|
|
|
@ -283,45 +283,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
no_working_directory,
|
no_working_directory,
|
||||||
"echo", "Build all projects");
|
"echo", "Build all projects");
|
||||||
cmTarget* allbuild = mf->FindTarget("ALL_BUILD");
|
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
|
// Add XCODE depend helper
|
||||||
std::string dir = mf->GetCurrentOutputDirectory();
|
std::string dir = mf->GetCurrentOutputDirectory();
|
||||||
m_CurrentXCodeHackMakefile = dir;
|
m_CurrentXCodeHackMakefile = dir;
|
||||||
|
|
|
@ -151,6 +151,9 @@ private:
|
||||||
const char* varNameSuffix,
|
const char* varNameSuffix,
|
||||||
const char* default_flags);
|
const char* default_flags);
|
||||||
protected:
|
protected:
|
||||||
|
virtual const char* GetInstallTargetName() { return "install"; }
|
||||||
|
virtual const char* GetPackageTargetName() { return "package"; }
|
||||||
|
|
||||||
int m_XcodeVersion;
|
int m_XcodeVersion;
|
||||||
std::vector<cmXCodeObject*> m_XCodeObjects;
|
std::vector<cmXCodeObject*> m_XCodeObjects;
|
||||||
cmXCodeObject* m_RootObject;
|
cmXCodeObject* m_RootObject;
|
||||||
|
|
Loading…
Reference in New Issue