CPack use IsOn when it's better than IsSet

This authorize more control because one can set
CPACK_ARCHIVE_COMPONENT_INSTALL to ON globally
and then set it selectively to OFF inside
a CPack project config file.
Sidenote: GetOption ought to be a 'const' method.
This commit is contained in:
Eric NOULARD 2010-12-12 12:55:02 +01:00
parent 1b98d99c28
commit 6d94ea3692
4 changed files with 11 additions and 4 deletions

View File

@ -285,7 +285,7 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const {
// The Component installation support should only // The Component installation support should only
// be activated if explicitly requested by the user // be activated if explicitly requested by the user
// (for backward compatibility reason) // (for backward compatibility reason)
if (IsSet("CPACK_ARCHIVE_COMPONENT_INSTALL")) if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"))
{ {
return true; return true;
} }

View File

@ -1063,7 +1063,13 @@ bool cmCPackGenerator::IsSet(const char* name) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const char* cmCPackGenerator::GetOption(const char* op) bool cmCPackGenerator::IsOn(const char* name) const
{
return cmSystemTools::IsOn(GetOption(name));
}
//----------------------------------------------------------------------
const char* cmCPackGenerator::GetOption(const char* op) const
{ {
const char* ret = this->MakefileMap->GetDefinition(op); const char* ret = this->MakefileMap->GetDefinition(op);
if(!ret) if(!ret)

View File

@ -88,8 +88,9 @@ public:
//! Set and get the options //! Set and get the options
void SetOption(const char* op, const char* value); void SetOption(const char* op, const char* value);
void SetOptionIfNotSet(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value);
const char* GetOption(const char* op); const char* GetOption(const char* op) const;
bool IsSet(const char* name) const; bool IsSet(const char* name) const;
bool IsOn(const char* name) const;
//! Set all the variables //! Set all the variables
int SetCMakeRoot(); int SetCMakeRoot();

View File

@ -108,7 +108,7 @@ int cmCPackRPMGenerator::PackageFiles()
bool cmCPackRPMGenerator::SupportsComponentInstallation() const bool cmCPackRPMGenerator::SupportsComponentInstallation() const
{ {
if (IsSet("CPACK_RPM_COMPONENT_INSTALL")) if (IsOn("CPACK_RPM_COMPONENT_INSTALL"))
{ {
return true; return true;
} }