From 50a0f71120afe28c205bacab5a1350eb04815f3d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 May 2006 14:57:19 -0400 Subject: [PATCH] ENH: Added CONFIGURATIONS option to INSTALL command to allow per-configuration install rules. --- Source/cmFileCommand.cxx | 51 +++++++++++++++++----- Source/cmInstallCommand.cxx | 65 +++++++++++++++++++++++++++- Source/cmInstallCommand.h | 5 +++ Source/cmInstallFilesGenerator.cxx | 5 ++- Source/cmInstallFilesGenerator.h | 2 + Source/cmInstallGenerator.cxx | 30 +++++++++---- Source/cmInstallGenerator.h | 15 ++++--- Source/cmInstallTargetGenerator.cxx | 11 +++-- Source/cmInstallTargetGenerator.h | 10 +++-- Source/cmLocalGenerator.cxx | 34 +++++++++++++-- Tests/SimpleInstall/CMakeLists.txt | 16 +++++++ Tests/SimpleInstallS2/CMakeLists.txt | 16 +++++++ 12 files changed, 223 insertions(+), 37 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 08d0d78af..3139b5b73 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -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 components; + std::set configurations; std::vector 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 ) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 0669b7f0b..057f3e0d5 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -123,6 +123,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector 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 const& args) std::string archive_component; std::string library_component; std::string runtime_component; + std::vector archive_configurations; + std::vector library_configurations; + std::vector runtime_configurations; for(unsigned int i=1; i < args.size(); ++i) { if(args[i] == "DESTINATION") @@ -145,6 +149,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector 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 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 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 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 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 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 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 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 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 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 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 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 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 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 files; const char* destination = 0; std::string rename; std::string permissions; + std::vector configurations; std::string component; for(unsigned int i=1; i < args.size(); ++i) { @@ -484,6 +527,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector 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 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 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 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 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 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. diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 3c10e5a8a..f325f062b 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -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 ]\n" " [PERMISSIONS permissions...]\n" + " [CONFIGURATIONS [Debug|Release|...]]\n" " [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 \n" " [PERMISSIONS permissions...]\n" + " [CONFIGURATIONS [Debug|Release|...]]\n" " [COMPONENT ]\n" " [RENAME ])\n" "The FILES form specifies rules for installing files for a " @@ -149,6 +153,7 @@ public: "The PROGRAMS signature:\n" " INSTALL(PROGRAMS files... DESTINATION \n" " [PERMISSIONS permissions...]\n" + " [CONFIGURATIONS [Debug|Release|...]]\n" " [COMPONENT ]\n" " [RENAME ])\n" "The PROGRAMS form is identical to the FILES form except that the " diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index bf0d83079..7990b2ac6 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -23,10 +23,12 @@ cmInstallFilesGenerator ::cmInstallFilesGenerator(std::vector const& files, const char* dest, bool programs, const char* permissions, + std::vector 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()); } diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 7732ff92a..4589b1e37 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -28,6 +28,7 @@ public: cmInstallFilesGenerator(std::vector const& files, const char* dest, bool programs, const char* permissions, + std::vector 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 Configurations; std::string Component; std::string Rename; }; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 44b693652..797fc0203 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -47,15 +47,18 @@ cmInstallGenerator } //---------------------------------------------------------------------------- -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 */, - const char* component /* = 0 */, - const char* rename /* = 0 */) +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 const& configurations /* = std::vector() */, + const char* component /* = 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::const_iterator c = configurations.begin(); + c != configurations.end(); ++c) + { + os << " \"" << *c << "\""; + } + } if(component && *component) { os << " COMPONENTS \"" << component << "\""; diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index fee0d681e..017c63a2a 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -34,12 +34,15 @@ public: void Generate(std::ostream& os, const char* config, std::vector const& configurationTypes); - 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, - const char* component = 0, - const char* rename = 0); + 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 const& configurations =std::vector(), + const char* component = 0, + const char* rename = 0 + ); protected: virtual void GenerateScript(std::ostream& os)=0; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 690904a69..b5cf24032 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -24,9 +24,12 @@ //---------------------------------------------------------------------------- cmInstallTargetGenerator ::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, - const char* permissions, const char* component): + const char* permissions, + std::vector 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 || diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 7d88bdec6..777b7afc4 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -27,9 +27,12 @@ class cmTarget; class cmInstallTargetGenerator: public cmInstallGenerator { public: - cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, - const char* permissions = "", - const char* component = ""); + cmInstallTargetGenerator( + cmTarget& t, const char* dest, bool implib, + const char* permissions = "", + std::vector const& configurations =std::vector(), + const char* component = "" + ); virtual ~cmInstallTargetGenerator(); protected: @@ -44,6 +47,7 @@ protected: std::string Destination; bool ImportLibrary; std::string Permissions; + std::vector Configurations; std::string Component; }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1641fc833..4241e4c53 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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::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 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 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; diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 461280df1..c2de5b1c6 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -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 diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 461280df1..c2de5b1c6 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -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