ENH: Added CONFIGURATIONS option to INSTALL command to allow per-configuration install rules.
This commit is contained in:
parent
059320a577
commit
50a0f71120
|
@ -323,19 +323,10 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
std::string rename = "";
|
||||
std::string destination = "";
|
||||
std::string stype = "FILES";
|
||||
const char* build_type = this->Makefile->GetDefinition("BUILD_TYPE");
|
||||
if ( build_type && strcmp(build_type, ".") == 0 )
|
||||
{
|
||||
build_type = 0;
|
||||
}
|
||||
if ( build_type && strncmp(build_type, ".\\", 2) == 0 )
|
||||
{
|
||||
build_type += 2;
|
||||
}
|
||||
|
||||
const char* destdir = cmSystemTools::GetEnv("DESTDIR");
|
||||
|
||||
std::set<cmStdString> components;
|
||||
std::set<cmStdString> configurations;
|
||||
std::vector<std::string> files;
|
||||
int itype = cmTarget::INSTALL_FILES;
|
||||
|
||||
|
@ -375,6 +366,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
bool in_properties = false;
|
||||
bool in_permissions = false;
|
||||
bool in_components = false;
|
||||
bool in_configurations = false;
|
||||
bool use_given_permissions = false;
|
||||
mode_t permissions = 0;
|
||||
bool optional = false;
|
||||
|
@ -389,6 +381,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_properties = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "TYPE" && i < args.size()-1 )
|
||||
{
|
||||
|
@ -403,6 +396,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_files = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "RENAME" && i < args.size()-1 )
|
||||
{
|
||||
|
@ -412,6 +406,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_files = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "PROPERTIES" )
|
||||
{
|
||||
|
@ -419,6 +414,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_files = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "PERMISSIONS" )
|
||||
{
|
||||
|
@ -427,6 +423,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_files = false;
|
||||
in_permissions = true;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "COMPONENTS" )
|
||||
{
|
||||
|
@ -434,6 +431,15 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_files = false;
|
||||
in_permissions = false;
|
||||
in_components = true;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( *cstr == "CONFIGURATIONS" )
|
||||
{
|
||||
in_properties = false;
|
||||
in_files = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = true;
|
||||
}
|
||||
else if ( *cstr == "FILES" && !in_files)
|
||||
{
|
||||
|
@ -441,6 +447,7 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
in_properties = false;
|
||||
in_permissions = false;
|
||||
in_components = false;
|
||||
in_configurations = false;
|
||||
}
|
||||
else if ( in_properties && i < args.size()-1 )
|
||||
{
|
||||
|
@ -455,6 +462,10 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
{
|
||||
components.insert(*cstr);
|
||||
}
|
||||
else if ( in_configurations )
|
||||
{
|
||||
configurations.insert(cmSystemTools::UpperCase(*cstr));
|
||||
}
|
||||
else if(in_permissions && args[i] == "OWNER_READ")
|
||||
{
|
||||
permissions |= mode_owner_read;
|
||||
|
@ -526,6 +537,26 @@ bool cmFileCommand::HandleInstallCommand(
|
|||
}
|
||||
}
|
||||
|
||||
// Check for configuration-specific installation.
|
||||
if(!configurations.empty())
|
||||
{
|
||||
std::string cmake_install_configuration =
|
||||
cmSystemTools::UpperCase(
|
||||
this->Makefile->GetSafeDefinition("CMAKE_INSTALL_CONFIG_NAME"));
|
||||
if(cmake_install_configuration.empty())
|
||||
{
|
||||
// No configuration specified for installation but this install
|
||||
// rule is configuration-specific. Skip it.
|
||||
return true;
|
||||
}
|
||||
else if(configurations.find(cmake_install_configuration) ==
|
||||
configurations.end())
|
||||
{
|
||||
// This rule is specific to a configuration not being installed.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int destDirLength = 0;
|
||||
if ( destdir && *destdir )
|
||||
{
|
||||
|
|
|
@ -123,6 +123,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
bool doing_destination = false;
|
||||
bool doing_permissions = false;
|
||||
bool doing_component = false;
|
||||
bool doing_configurations = false;
|
||||
bool archive_settings = true;
|
||||
bool library_settings = true;
|
||||
bool runtime_settings = true;
|
||||
|
@ -136,6 +137,9 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
std::string archive_component;
|
||||
std::string library_component;
|
||||
std::string runtime_component;
|
||||
std::vector<std::string> archive_configurations;
|
||||
std::vector<std::string> library_configurations;
|
||||
std::vector<std::string> runtime_configurations;
|
||||
for(unsigned int i=1; i < args.size(); ++i)
|
||||
{
|
||||
if(args[i] == "DESTINATION")
|
||||
|
@ -145,6 +149,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = true;
|
||||
doing_permissions = false;
|
||||
doing_component = false;
|
||||
doing_configurations = false;
|
||||
}
|
||||
else if(args[i] == "PERMISSIONS")
|
||||
{
|
||||
|
@ -153,6 +158,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = false;
|
||||
doing_permissions = true;
|
||||
doing_component = false;
|
||||
doing_configurations = false;
|
||||
}
|
||||
else if(args[i] == "COMPONENT")
|
||||
{
|
||||
|
@ -161,6 +167,16 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_component = true;
|
||||
doing_configurations = false;
|
||||
}
|
||||
else if(args[i] == "CONFIGURATIONS")
|
||||
{
|
||||
// Switch to setting the configurations property.
|
||||
doing_targets = false;
|
||||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_component = false;
|
||||
doing_configurations = true;
|
||||
}
|
||||
else if(args[i] == "ARCHIVE")
|
||||
{
|
||||
|
@ -169,6 +185,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_component = false;
|
||||
doing_configurations = false;
|
||||
archive_settings = true;
|
||||
library_settings = false;
|
||||
runtime_settings = false;
|
||||
|
@ -180,6 +197,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_component = false;
|
||||
doing_configurations = false;
|
||||
archive_settings = false;
|
||||
library_settings = true;
|
||||
runtime_settings = false;
|
||||
|
@ -191,6 +209,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_component = false;
|
||||
doing_configurations = false;
|
||||
archive_settings = false;
|
||||
library_settings = false;
|
||||
runtime_settings = true;
|
||||
|
@ -300,6 +319,22 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(doing_configurations)
|
||||
{
|
||||
// Add the configuration in the active set(s) of properties.
|
||||
if(archive_settings)
|
||||
{
|
||||
archive_configurations.push_back(args[i]);
|
||||
}
|
||||
if(library_settings)
|
||||
{
|
||||
library_configurations.push_back(args[i]);
|
||||
}
|
||||
if(runtime_settings)
|
||||
{
|
||||
runtime_configurations.push_back(args[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unknown argument.
|
||||
|
@ -351,6 +386,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, archive_dest.c_str(), true,
|
||||
archive_permissions.c_str(),
|
||||
archive_configurations,
|
||||
archive_component.c_str()));
|
||||
}
|
||||
if(runtime_destination)
|
||||
|
@ -359,6 +395,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
|
||||
runtime_permissions.c_str(),
|
||||
runtime_configurations,
|
||||
runtime_component.c_str()));
|
||||
}
|
||||
#else
|
||||
|
@ -369,6 +406,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
|
||||
library_permissions.c_str(),
|
||||
library_configurations,
|
||||
library_component.c_str()));
|
||||
}
|
||||
else
|
||||
|
@ -390,6 +428,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, archive_dest.c_str(), false,
|
||||
archive_permissions.c_str(),
|
||||
archive_configurations,
|
||||
archive_component.c_str()));
|
||||
}
|
||||
else
|
||||
|
@ -410,6 +449,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
|
||||
library_permissions.c_str(),
|
||||
library_configurations,
|
||||
library_component.c_str()));
|
||||
}
|
||||
else
|
||||
|
@ -430,6 +470,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
|
|||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
|
||||
runtime_permissions.c_str(),
|
||||
runtime_configurations,
|
||||
runtime_component.c_str()));
|
||||
}
|
||||
else
|
||||
|
@ -469,12 +510,14 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
bool doing_files = true;
|
||||
bool doing_destination = false;
|
||||
bool doing_permissions = false;
|
||||
bool doing_configurations = false;
|
||||
bool doing_component = false;
|
||||
bool doing_rename = false;
|
||||
std::vector<std::string> files;
|
||||
const char* destination = 0;
|
||||
std::string rename;
|
||||
std::string permissions;
|
||||
std::vector<std::string> configurations;
|
||||
std::string component;
|
||||
for(unsigned int i=1; i < args.size(); ++i)
|
||||
{
|
||||
|
@ -484,6 +527,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
doing_files = false;
|
||||
doing_destination = true;
|
||||
doing_permissions = false;
|
||||
doing_configurations = false;
|
||||
doing_component = false;
|
||||
doing_rename = false;
|
||||
}
|
||||
|
@ -493,6 +537,17 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
doing_files = false;
|
||||
doing_destination = false;
|
||||
doing_permissions = true;
|
||||
doing_configurations = false;
|
||||
doing_component = false;
|
||||
doing_rename = false;
|
||||
}
|
||||
else if(args[i] == "CONFIGURATIONS")
|
||||
{
|
||||
// Switch to setting the configurations property.
|
||||
doing_files = false;
|
||||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_configurations = true;
|
||||
doing_component = false;
|
||||
doing_rename = false;
|
||||
}
|
||||
|
@ -502,6 +557,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
doing_files = false;
|
||||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_configurations = false;
|
||||
doing_component = true;
|
||||
doing_rename = false;
|
||||
}
|
||||
|
@ -511,6 +567,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
doing_files = false;
|
||||
doing_destination = false;
|
||||
doing_permissions = false;
|
||||
doing_configurations = false;
|
||||
doing_component = false;
|
||||
doing_rename = true;
|
||||
}
|
||||
|
@ -537,6 +594,10 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
// Store the file for installation.
|
||||
files.push_back(file);
|
||||
}
|
||||
else if(doing_configurations)
|
||||
{
|
||||
configurations.push_back(args[i]);
|
||||
}
|
||||
else if(doing_destination)
|
||||
{
|
||||
destination = args[i].c_str();
|
||||
|
@ -603,8 +664,8 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
|
|||
// Create the files install generator.
|
||||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallFilesGenerator(files, dest.c_str(), programs,
|
||||
permissions.c_str(), component.c_str(),
|
||||
rename.c_str()));
|
||||
permissions.c_str(), configurations,
|
||||
component.c_str(), rename.c_str()));
|
||||
|
||||
// Tell the global generator about any installation component names
|
||||
// specified.
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
"SETUID, and SETGID. "
|
||||
"Permissions that do not make sense on certain platforms are ignored "
|
||||
"on those platforms. "
|
||||
"The CONFIGURATIONS argument specifies a list of build configurations "
|
||||
"for which the install rule applies (Debug, Release, etc.). "
|
||||
"The COMPONENT argument specifies an installation component name "
|
||||
"with which the install rule is associated, such as \"runtime\" or "
|
||||
"\"development\". During component-specific installation only "
|
||||
|
@ -96,6 +98,7 @@ public:
|
|||
" INSTALL(TARGETS targets... [[ARCHIVE|LIBRARY|RUNTIME]\n"
|
||||
" [DESTINATION <dir>]\n"
|
||||
" [PERMISSIONS permissions...]\n"
|
||||
" [CONFIGURATIONS [Debug|Release|...]]\n"
|
||||
" [COMPONENT <component>]\n"
|
||||
" ] [...])\n"
|
||||
"The TARGETS form specifies rules for installing targets from a "
|
||||
|
@ -138,6 +141,7 @@ public:
|
|||
"The FILES signature:\n"
|
||||
" INSTALL(FILES files... DESTINATION <dir>\n"
|
||||
" [PERMISSIONS permissions...]\n"
|
||||
" [CONFIGURATIONS [Debug|Release|...]]\n"
|
||||
" [COMPONENT <component>]\n"
|
||||
" [RENAME <name>])\n"
|
||||
"The FILES form specifies rules for installing files for a "
|
||||
|
@ -149,6 +153,7 @@ public:
|
|||
"The PROGRAMS signature:\n"
|
||||
" INSTALL(PROGRAMS files... DESTINATION <dir>\n"
|
||||
" [PERMISSIONS permissions...]\n"
|
||||
" [CONFIGURATIONS [Debug|Release|...]]\n"
|
||||
" [COMPONENT <component>]\n"
|
||||
" [RENAME <name>])\n"
|
||||
"The PROGRAMS form is identical to the FILES form except that the "
|
||||
|
|
|
@ -23,10 +23,12 @@ cmInstallFilesGenerator
|
|||
::cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||
const char* dest, bool programs,
|
||||
const char* permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
const char* component,
|
||||
const char* rename):
|
||||
Files(files), Destination(dest), Programs(programs),
|
||||
Permissions(permissions), Component(component), Rename(rename)
|
||||
Permissions(permissions), Configurations(configurations),
|
||||
Component(component), Rename(rename)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,7 @@ void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
|
|||
: cmTarget::INSTALL_FILES), fi->c_str(),
|
||||
not_optional, no_properties,
|
||||
this->Permissions.c_str(),
|
||||
this->Configurations,
|
||||
this->Component.c_str(),
|
||||
this->Rename.c_str());
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||
const char* dest, bool programs,
|
||||
const char* permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
const char* component,
|
||||
const char* rename);
|
||||
virtual ~cmInstallFilesGenerator();
|
||||
|
@ -38,6 +39,7 @@ protected:
|
|||
std::string Destination;
|
||||
bool Programs;
|
||||
std::string Permissions;
|
||||
std::vector<std::string> Configurations;
|
||||
std::string Component;
|
||||
std::string Rename;
|
||||
};
|
||||
|
|
|
@ -47,15 +47,18 @@ cmInstallGenerator
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmInstallGenerator::AddInstallRule(std::ostream& os,
|
||||
void cmInstallGenerator::AddInstallRule(
|
||||
std::ostream& os,
|
||||
const char* dest,
|
||||
int type,
|
||||
const char* file,
|
||||
bool optional /* = false */,
|
||||
const char* properties /* = 0 */,
|
||||
const char* permissions /* = 0 */,
|
||||
std::vector<std::string> const& configurations /* = std::vector<std::string>() */,
|
||||
const char* component /* = 0 */,
|
||||
const char* rename /* = 0 */)
|
||||
const char* rename /* = 0 */
|
||||
)
|
||||
{
|
||||
// Use the FILE command to install the file.
|
||||
std::string stype;
|
||||
|
@ -87,6 +90,15 @@ void cmInstallGenerator::AddInstallRule(std::ostream& os,
|
|||
{
|
||||
os << " RENAME \"" << rename << "\"";
|
||||
}
|
||||
if(!configurations.empty())
|
||||
{
|
||||
os << " CONFIGURATIONS";
|
||||
for(std::vector<std::string>::const_iterator c = configurations.begin();
|
||||
c != configurations.end(); ++c)
|
||||
{
|
||||
os << " \"" << *c << "\"";
|
||||
}
|
||||
}
|
||||
if(component && *component)
|
||||
{
|
||||
os << " COMPONENTS \"" << component << "\"";
|
||||
|
|
|
@ -34,12 +34,15 @@ public:
|
|||
void Generate(std::ostream& os, const char* config,
|
||||
std::vector<std::string> const& configurationTypes);
|
||||
|
||||
static void AddInstallRule(std::ostream& os, const char* dest, int type,
|
||||
static void AddInstallRule(
|
||||
std::ostream& os, const char* dest, int type,
|
||||
const char* file, bool optional = false,
|
||||
const char* properties = 0,
|
||||
const char* permissions = 0,
|
||||
std::vector<std::string> const& configurations =std::vector<std::string>(),
|
||||
const char* component = 0,
|
||||
const char* rename = 0);
|
||||
const char* rename = 0
|
||||
);
|
||||
|
||||
protected:
|
||||
virtual void GenerateScript(std::ostream& os)=0;
|
||||
|
|
|
@ -24,9 +24,12 @@
|
|||
//----------------------------------------------------------------------------
|
||||
cmInstallTargetGenerator
|
||||
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
|
||||
const char* permissions, const char* component):
|
||||
const char* permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
const char* component):
|
||||
Target(&t), Destination(dest), ImportLibrary(implib),
|
||||
Permissions(permissions), Component(component)
|
||||
Permissions(permissions), Configurations(configurations),
|
||||
Component(component)
|
||||
{
|
||||
this->Target->SetHaveInstallRule(true);
|
||||
}
|
||||
|
@ -145,7 +148,9 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
|
|||
// Write code to install the target file.
|
||||
this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(),
|
||||
this->ImportLibrary, properties,
|
||||
this->Permissions.c_str(), this->Component.c_str());
|
||||
this->Permissions.c_str(),
|
||||
this->Configurations,
|
||||
this->Component.c_str());
|
||||
|
||||
// Fix the install_name settings in installed binaries.
|
||||
if(type == cmTarget::SHARED_LIBRARY ||
|
||||
|
|
|
@ -27,9 +27,12 @@ class cmTarget;
|
|||
class cmInstallTargetGenerator: public cmInstallGenerator
|
||||
{
|
||||
public:
|
||||
cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
|
||||
cmInstallTargetGenerator(
|
||||
cmTarget& t, const char* dest, bool implib,
|
||||
const char* permissions = "",
|
||||
const char* component = "");
|
||||
std::vector<std::string> const& configurations =std::vector<std::string>(),
|
||||
const char* component = ""
|
||||
);
|
||||
virtual ~cmInstallTargetGenerator();
|
||||
|
||||
protected:
|
||||
|
@ -44,6 +47,7 @@ protected:
|
|||
std::string Destination;
|
||||
bool ImportLibrary;
|
||||
std::string Permissions;
|
||||
std::vector<std::string> Configurations;
|
||||
std::string Component;
|
||||
};
|
||||
|
||||
|
|
|
@ -289,6 +289,30 @@ void cmLocalGenerator::GenerateInstallRules()
|
|||
config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||
}
|
||||
|
||||
// Choose a default install configuration.
|
||||
const char* default_config = config;
|
||||
const char* default_order[] = {"RELEASE", "MINSIZEREL",
|
||||
"RELWITHDEBINFO", "DEBUG", 0};
|
||||
for(const char** c = default_order; *c && !default_config; ++c)
|
||||
{
|
||||
for(std::vector<std::string>::iterator i = configurationTypes.begin();
|
||||
i != configurationTypes.end(); ++i)
|
||||
{
|
||||
if(cmSystemTools::UpperCase(*i) == *c)
|
||||
{
|
||||
default_config = i->c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!default_config && !configurationTypes.empty())
|
||||
{
|
||||
default_config = configurationTypes[0].c_str();
|
||||
}
|
||||
if(!default_config)
|
||||
{
|
||||
default_config = "Release";
|
||||
}
|
||||
|
||||
// Create the install script file.
|
||||
std::string file = this->Makefile->GetStartOutputDirectory();
|
||||
std::string homedir = this->Makefile->GetHomeOutputDirectory();
|
||||
|
@ -323,7 +347,7 @@ void cmLocalGenerator::GenerateInstallRules()
|
|||
" STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n"
|
||||
" CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n"
|
||||
" ELSE(BUILD_TYPE)\n"
|
||||
" SET(CMAKE_INSTALL_CONFIG_NAME Release)\n"
|
||||
" SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n"
|
||||
" ENDIF(BUILD_TYPE)\n"
|
||||
" MESSAGE(STATUS \"Install configuration: \\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n"
|
||||
"ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)\n"
|
||||
|
@ -1955,9 +1979,11 @@ cmLocalGenerator
|
|||
const char* no_permissions = "";
|
||||
const char* no_rename = "";
|
||||
const char* no_component = "";
|
||||
std::vector<std::string> no_configurations;
|
||||
cmInstallFilesGenerator g(l->second.GetSourceLists(),
|
||||
destination.c_str(), false,
|
||||
no_permissions, no_component, no_rename);
|
||||
no_permissions, no_configurations,
|
||||
no_component, no_rename);
|
||||
g.Generate(os, config, configurationTypes);
|
||||
}
|
||||
break;
|
||||
|
@ -1967,9 +1993,11 @@ cmLocalGenerator
|
|||
const char* no_permissions = "";
|
||||
const char* no_rename = "";
|
||||
const char* no_component = "";
|
||||
std::vector<std::string> no_configurations;
|
||||
cmInstallFilesGenerator g(l->second.GetSourceLists(),
|
||||
destination.c_str(), true,
|
||||
no_permissions, no_component, no_rename);
|
||||
no_permissions, no_configurations,
|
||||
no_component, no_rename);
|
||||
g.Generate(os, config, configurationTypes);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -72,6 +72,14 @@ IF(STAGE2)
|
|||
MESSAGE(SEND_ERROR "test1 not found in lib/static!")
|
||||
ENDIF("${TEST1_LIBRARY}" MATCHES "static")
|
||||
|
||||
# Check for failure of configuration-specific installation.
|
||||
IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
|
||||
MESSAGE(FATAL_ERROR "Debug-configuration file installed for Release!")
|
||||
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
|
||||
IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
|
||||
MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!")
|
||||
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
|
||||
|
||||
# Make sure the test executable can run from the install tree.
|
||||
SET_TARGET_PROPERTIES(SimpleInstallS2 PROPERTIES
|
||||
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
|
||||
|
@ -122,6 +130,14 @@ ELSE(STAGE2)
|
|||
)
|
||||
INSTALL_FILES(/MyTest/include FILES lib3.h)
|
||||
|
||||
# Test configuration-specific installation.
|
||||
INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
|
||||
DESTINATION MyTest/include/Release
|
||||
)
|
||||
INSTALL(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
|
||||
DESTINATION MyTest/include/Debug
|
||||
)
|
||||
|
||||
# Test user-specified install scripts.
|
||||
INSTALL(
|
||||
SCRIPT InstallScript1.cmake
|
||||
|
|
|
@ -72,6 +72,14 @@ IF(STAGE2)
|
|||
MESSAGE(SEND_ERROR "test1 not found in lib/static!")
|
||||
ENDIF("${TEST1_LIBRARY}" MATCHES "static")
|
||||
|
||||
# Check for failure of configuration-specific installation.
|
||||
IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
|
||||
MESSAGE(FATAL_ERROR "Debug-configuration file installed for Release!")
|
||||
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
|
||||
IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
|
||||
MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!")
|
||||
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
|
||||
|
||||
# Make sure the test executable can run from the install tree.
|
||||
SET_TARGET_PROPERTIES(SimpleInstallS2 PROPERTIES
|
||||
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
|
||||
|
@ -122,6 +130,14 @@ ELSE(STAGE2)
|
|||
)
|
||||
INSTALL_FILES(/MyTest/include FILES lib3.h)
|
||||
|
||||
# Test configuration-specific installation.
|
||||
INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
|
||||
DESTINATION MyTest/include/Release
|
||||
)
|
||||
INSTALL(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
|
||||
DESTINATION MyTest/include/Debug
|
||||
)
|
||||
|
||||
# Test user-specified install scripts.
|
||||
INSTALL(
|
||||
SCRIPT InstallScript1.cmake
|
||||
|
|
Loading…
Reference in New Issue