diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 38002ec48..6e246e6e0 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -392,10 +392,6 @@ void cmExtraCodeBlocksGenerator make.c_str(), makefile, compiler.c_str()); } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 07549e918..c8c86c700 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1045,10 +1045,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6df5ab38f..3f14fa1e1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -12,6 +12,7 @@ #include "cmFileCommand.h" #include "cmake.h" #include "cmHexFileConverter.h" +#include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" @@ -1690,7 +1691,7 @@ struct cmFileInstaller: public cmFileCopier { cmFileInstaller(cmFileCommand* command): cmFileCopier(command, "INSTALL"), - InstallType(cmTarget::INSTALL_FILES), + InstallType(cmInstallType_FILES), Optional(false), DestDirLength(0) { @@ -1711,7 +1712,7 @@ struct cmFileInstaller: public cmFileCopier } protected: - cmTarget::TargetType InstallType; + cmInstallType InstallType; bool Optional; int DestDirLength; std::string Rename; @@ -1745,7 +1746,7 @@ protected: virtual bool Install(const char* fromFile, const char* toFile) { // Support installing from empty source to make a directory. - if(this->InstallType == cmTarget::INSTALL_DIRECTORY && !*fromFile) + if(this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { return this->InstallDirectory(fromFile, toFile, MatchProperties()); } @@ -1767,14 +1768,14 @@ protected: // Add execute permissions based on the target type. switch(this->InstallType) { - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: + case cmInstallType_SHARED_LIBRARY: + case cmInstallType_MODULE_LIBRARY: if(this->Makefile->IsOn("CMAKE_INSTALL_SO_NO_EXE")) { break; } - case cmTarget::EXECUTABLE: - case cmTarget::INSTALL_PROGRAMS: + case cmInstallType_EXECUTABLE: + case cmInstallType_PROGRAMS: this->FilePermissions |= mode_owner_execute; this->FilePermissions |= mode_group_execute; this->FilePermissions |= mode_world_execute; @@ -1796,8 +1797,8 @@ bool cmFileInstaller::Parse(std::vector const& args) if(!this->Rename.empty()) { - if(this->InstallType != cmTarget::INSTALL_FILES && - this->InstallType != cmTarget::INSTALL_PROGRAMS) + if(this->InstallType != cmInstallType_FILES && + this->InstallType != cmInstallType_PROGRAMS) { this->FileCommand->SetError("INSTALL option RENAME may be used " "only with FILES or PROGRAMS."); @@ -1936,31 +1937,31 @@ bool cmFileInstaller { if ( stype == "EXECUTABLE" ) { - this->InstallType = cmTarget::EXECUTABLE; + this->InstallType = cmInstallType_EXECUTABLE; } else if ( stype == "FILE" ) { - this->InstallType = cmTarget::INSTALL_FILES; + this->InstallType = cmInstallType_FILES; } else if ( stype == "PROGRAM" ) { - this->InstallType = cmTarget::INSTALL_PROGRAMS; + this->InstallType = cmInstallType_PROGRAMS; } else if ( stype == "STATIC_LIBRARY" ) { - this->InstallType = cmTarget::STATIC_LIBRARY; + this->InstallType = cmInstallType_STATIC_LIBRARY; } else if ( stype == "SHARED_LIBRARY" ) { - this->InstallType = cmTarget::SHARED_LIBRARY; + this->InstallType = cmInstallType_SHARED_LIBRARY; } else if ( stype == "MODULE" ) { - this->InstallType = cmTarget::MODULE_LIBRARY; + this->InstallType = cmInstallType_MODULE_LIBRARY; } else if ( stype == "DIRECTORY" ) { - this->InstallType = cmTarget::INSTALL_DIRECTORY; + this->InstallType = cmInstallType_DIRECTORY; } else { diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ab32f9488..ddf7d08cc 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -42,7 +42,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, { // Write code to install the directories. const char* no_rename = 0; - this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY, + this->AddInstallRule(os, cmInstallType_DIRECTORY, this->Directories, this->Optional, this->FilePermissions.c_str(), diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 69e3f2c8e..28a19d740 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,7 +16,6 @@ #include "cmake.h" #include "cmInstallTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" @@ -186,7 +185,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); os << indent << "IF(" << config_test << ")\n"; - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); os << indent << "ENDIF(" << config_test << ")\n"; @@ -225,6 +224,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, // Install the main export file. std::vector files; files.push_back(this->MainImportFile); - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28f055fc9..ec02bc76a 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmInstallFilesGenerator.h" -#include "cmTarget.h" - //---------------------------------------------------------------------------- cmInstallFilesGenerator ::cmInstallFilesGenerator(std::vector const& files, @@ -43,8 +41,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, const char* no_dir_permissions = 0; this->AddInstallRule(os, (this->Programs - ? cmTarget::INSTALL_PROGRAMS - : cmTarget::INSTALL_FILES), + ? cmInstallType_PROGRAMS + : cmInstallType_FILES), this->Files, this->Optional, this->FilePermissions.c_str(), no_dir_permissions, diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d7505dc9f..807168e0d 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -12,7 +12,6 @@ #include "cmInstallGenerator.h" #include "cmSystemTools.h" -#include "cmTarget.h" //---------------------------------------------------------------------------- cmInstallGenerator @@ -35,7 +34,7 @@ cmInstallGenerator void cmInstallGenerator ::AddInstallRule( std::ostream& os, - int type, + cmInstallType type, std::vector const& files, bool optional /* = false */, const char* permissions_file /* = 0 */, @@ -49,14 +48,13 @@ void cmInstallGenerator std::string stype; switch(type) { - case cmTarget::INSTALL_DIRECTORY:stype = "DIRECTORY"; break; - case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break; - case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break; - case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; - case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; - case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break; - case cmTarget::INSTALL_FILES: - default: stype = "FILE"; break; + case cmInstallType_DIRECTORY: stype = "DIRECTORY"; break; + case cmInstallType_PROGRAMS: stype = "PROGRAM"; break; + case cmInstallType_EXECUTABLE: stype = "EXECUTABLE"; break; + case cmInstallType_STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; + case cmInstallType_SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; + case cmInstallType_MODULE_LIBRARY: stype = "MODULE"; break; + case cmInstallType_FILES: stype = "FILE"; break; } os << indent; std::string dest = this->GetInstallDestination(); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index aa9a47c09..c89ab8ac5 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -12,6 +12,7 @@ #ifndef cmInstallGenerator_h #define cmInstallGenerator_h +#include "cmInstallType.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -29,7 +30,7 @@ public: virtual ~cmInstallGenerator(); void AddInstallRule( - std::ostream& os, int type, + std::ostream& os, cmInstallType type, std::vector const& files, bool optional = false, const char* permissions_file = 0, diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ac1c94944..c74dda063 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -82,8 +82,22 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::vector filesFrom; std::vector filesTo; std::string literal_args; - cmTarget::TargetType type = this->Target->GetType(); - if(type == cmTarget::EXECUTABLE) + cmTarget::TargetType targetType = this->Target->GetType(); + cmInstallType type = cmInstallType(); + switch(targetType) + { + case cmTarget::EXECUTABLE: type = cmInstallType_EXECUTABLE; break; + case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; + case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; + case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; + case cmTarget::UTILITY: + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + "cmInstallTargetGenerator created with non-installable target."); + return; + } + if(targetType == cmTarget::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -110,7 +124,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else { @@ -121,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, if(this->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; @@ -173,7 +187,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else if(this->Target->IsFrameworkOnApple()) { @@ -181,7 +195,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, assert(this->NamelinkMode == NamelinkModeNone); // Install the whole framework directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; std::string from1 = fromDirConfig + targetName + ".framework"; diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h new file mode 100644 index 000000000..a8373682c --- /dev/null +++ b/Source/cmInstallType.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstallType_h +#define cmInstallType_h + +/** + * Enumerate types known to file(INSTALL). + */ +enum cmInstallType +{ + cmInstallType_EXECUTABLE, + cmInstallType_STATIC_LIBRARY, + cmInstallType_SHARED_LIBRARY, + cmInstallType_MODULE_LIBRARY, + cmInstallType_FILES, + cmInstallType_PROGRAMS, + cmInstallType_DIRECTORY +}; + +#endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 501fe614f..dc8d1c4be 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1909,10 +1909,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, // A utility target has no file on which to depend. This was listed // only to get the target-level dependency. return false; - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: - break; } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c79b30cc..da99eb987 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -43,12 +43,6 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "UTILITY"; case cmTarget::GLOBAL_TARGET: return "GLOBAL_TARGET"; - case cmTarget::INSTALL_FILES: - return "INSTALL_FILES"; - case cmTarget::INSTALL_PROGRAMS: - return "INSTALL_PROGRAMS"; - case cmTarget::INSTALL_DIRECTORY: - return "INSTALL_DIRECTORY"; case cmTarget::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } @@ -1184,16 +1178,6 @@ void cmTarget::DefineProperties(cmake *cm) void cmTarget::SetType(TargetType type, const char* name) { this->Name = name; - if(type == cmTarget::INSTALL_FILES || - type == cmTarget::INSTALL_PROGRAMS || - type == cmTarget::INSTALL_DIRECTORY) - { - this->Makefile-> - IssueMessage(cmake::INTERNAL_ERROR, - "SetType called on cmTarget for INSTALL_FILES, " - "INSTALL_PROGRAMS, or INSTALL_DIRECTORY "); - return; - } // only add dependency information for library targets this->TargetTypeValue = type; if(this->TargetTypeValue >= STATIC_LIBRARY diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 59f018483..f4b6955bb 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -60,7 +60,6 @@ public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, - INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY, UNKNOWN_LIBRARY}; static const char* GetTargetTypeName(TargetType targetType); enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };