diff --git a/CMakeLists.txt b/CMakeLists.txt index c340cbd66c0eef7f7eb0c9e52d1c95fa09e6cbe1..386d5b7b0d8a7d7a629351cd744a209a0405a9f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 6) SET(CMake_VERSION_PATCH 1) -SET(CMake_VERSION_RC 2) +SET(CMake_VERSION_RC 3) # CVS versions are odd, if this is an odd minor version # then set the CMake_VERSION_DATE variable IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") diff --git a/ChangeLog.manual b/ChangeLog.manual index f7ac5b37f57f83d35f05f1adacd5fd8934b73ff4..19d66751452995331722bcdb1de09e700739b092 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,10 @@ +Changes in CMake 2.6.1 RC 3 +- FindQt4 - Find qt debug libraries on windows with d postfix. +- Find 64 bit windows registry stuff with 32 bit cmake +- Give a message if rpath is changed during install +- rpath changer during install understands symlinks now +- If a source file is not found and is a full path cmake complains again +- Changes in CMake 2.6.1 RC 2 - FindQt4 - report an error when trying to use MSVC with Qt built by mingw. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 14952fb38f33b87c64121d5f493fc2b71e00f36b..d07bc0b87e2f39cad06042abbe7e83b7de8b81b6 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -704,11 +704,11 @@ IF (QT4_QMAKE_FOUND) # Set QT_QT3SUPPORT_LIBRARY FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Support_debug Qt3Supportd Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTGUI_LIBRARY FIND_LIBRARY(QT_QTGUI_LIBRARY_RELEASE NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGui_debug QtGuid QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTMOTIF_LIBRARY IF(Q_WS_X11) @@ -718,7 +718,7 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTNETWORK_LIBRARY FIND_LIBRARY(QT_QTNETWORK_LIBRARY_RELEASE NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetwork_debug QtNetworkd QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTNSPLUGIN_LIBRARY FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_RELEASE NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) @@ -726,19 +726,19 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTOPENGL_LIBRARY FIND_LIBRARY(QT_QTOPENGL_LIBRARY_RELEASE NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGL_debug QtOpenGLd QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTSQL_LIBRARY FIND_LIBRARY(QT_QTSQL_LIBRARY_RELEASE NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSql_debug QtSqld QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTXML_LIBRARY FIND_LIBRARY(QT_QTXML_LIBRARY_RELEASE NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXml_debug QtXmld QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTSVG_LIBRARY FIND_LIBRARY(QT_QTSVG_LIBRARY_RELEASE NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG NAMES QtSvg_debug QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG NAMES QtSvg_debug QtSvgd QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTUITOOLS_LIBRARY FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) @@ -750,17 +750,17 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTTEST_LIBRARY FIND_LIBRARY(QT_QTTEST_LIBRARY_RELEASE NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG NAMES QtTest_debug QtTest_debug4 QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG NAMES QtTest_debug QtTestd QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTDBUS_LIBRARY # This was introduced with Qt 4.2, where also the naming scheme for debug libs was changed # So does any of the debug lib names listed here actually exist ? FIND_LIBRARY(QT_QTDBUS_LIBRARY_RELEASE NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBus_debug QtDBus_debug4 QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBus_debug QtDBusd QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTSCRIPT_LIBRARY FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_RELEASE NAMES QtScript QtScript4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_DEBUG NAMES QtScript_debug QtScriptd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTSCRIPT_LIBRARY_DEBUG NAMES QtScript_debug QtScriptd QtScriptd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE ) @@ -782,11 +782,11 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTDESIGNER_LIBRARY FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTDESIGNERCOMPONENTS_LIBRARY FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents QtDesignerComponents4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents_debug QtDesignerComponentsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents_debug QtDesignerComponentsd QtDesignerComponentsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTMAIN_LIBRARY IF(WIN32) @@ -798,13 +798,13 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTASSISTANTCLIENT_LIBRARY FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistantClient4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient_debug QtAssistantClientd QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTHELP_LIBRARY FIND_LIBRARY(QT_QTHELP_LIBRARY_RELEASE NAMES QtHelp QtHelp4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTHELP_LIBRARY_DEBUG NAMES QtHelp_debug QtHelpd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTHELP_LIBRARY_DEBUG NAMES QtHelp_debug QtHelpd QtHelpd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene QtCLucene4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene_debug QtCLucened4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene_debug QtCLucened QtCLucened4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # QtCLucene not with other frameworks with binary installation (in /usr/lib) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene PATHS ${QT_LIBRARY_DIR}) @@ -812,15 +812,15 @@ IF (QT4_QMAKE_FOUND) # Set QT_QTWEBKIT_LIBRARY FIND_LIBRARY(QT_QTWEBKIT_LIBRARY_RELEASE NAMES QtWebKit QtWebKit4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTWEBKIT_LIBRARY_DEBUG NAMES QtWebKit_debug QtWebKitd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTWEBKIT_LIBRARY_DEBUG NAMES QtWebKit_debug QtWebKitd QtWebKitd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_QTXMLPATTERNS_LIBRARY FIND_LIBRARY(QT_QTXMLPATTERNS_LIBRARY_RELEASE NAMES QtXmlPatterns QtXmlPatterns4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTXMLPATTERNS_LIBRARY_DEBUG NAMES QtXmlPatterns_debug QtXmlPatternsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTXMLPATTERNS_LIBRARY_DEBUG NAMES QtXmlPatterns_debug QtXmlPatternsd QtXmlPatternsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) # Set QT_PHONON_LIBRARY FIND_LIBRARY(QT_PHONON_LIBRARY_RELEASE NAMES phonon phonon4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_PHONON_LIBRARY_DEBUG NAMES phonon_debug phonond4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_PHONON_LIBRARY_DEBUG NAMES phonon_debug phonond phonond4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) ############################################ # diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index be2bf652f7bf5ee163b2d73734de11a6804eea9e..6ac6bccaed90dd0dfcdd215afb61761c5acb60cf 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1411,7 +1411,8 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args) cmSystemToolsFileTime* ft = cmSystemTools::FileTimeNew(); bool have_ft = cmSystemTools::FileTimeGet(file, ft); std::string emsg; - if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg)) + bool changed; + if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed)) { cmOStringStream e; e << "RPATH_CHANGE could not write new RPATH:\n" @@ -1422,9 +1423,21 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args) this->SetError(e.str().c_str()); success = false; } - if(success && have_ft) + if(success) { - cmSystemTools::FileTimeSet(file, ft); + if(changed) + { + std::string message = "Set runtime path of \""; + message += file; + message += "\" to \""; + message += newRPath; + message += "\""; + this->Makefile->DisplayStatus(message.c_str(), -1); + } + if(have_ft) + { + cmSystemTools::FileTimeSet(file, ft); + } } cmSystemTools::FileTimeDelete(ft); return success; diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index c4f380e4ca3580b09035b7a4ea5704798f9b4181..8d519bc271f6647fbc0d80ab55e0b1bb0c44fb8e 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -475,6 +475,28 @@ void cmFindBase::AddCMakeSystemVariables() void cmFindBase::ExpandRegistryAndCleanPath(std::vector<std::string>& paths) { + // We should view the registry as the target application would view + // it. + cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_Default; + cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_Default; + { + if(const char* psize = + this->Makefile->GetDefinition("CMAKE_SIZEOF_VOID_P")) + { + switch(atoi(psize)) + { + case 4: + view = cmSystemTools::KeyWOW64_32; + other_view = cmSystemTools::KeyWOW64_64; + break; + case 8: + view = cmSystemTools::KeyWOW64_64; + other_view = cmSystemTools::KeyWOW64_32; + break; + default: break; + } + } + } std::vector<std::string> finalPath; std::vector<std::string>::iterator i; // glob and expand registry stuff from paths and put @@ -482,8 +504,17 @@ void cmFindBase::ExpandRegistryAndCleanPath(std::vector<std::string>& paths) for(i = paths.begin(); i != paths.end(); ++i) { - cmSystemTools::ExpandRegistryValues(*i); - cmSystemTools::GlobDirs(i->c_str(), finalPath); + std::string expanded = *i; + cmSystemTools::ExpandRegistryValues(expanded, view); + cmSystemTools::GlobDirs(expanded.c_str(), finalPath); + if(view != other_view && expanded != *i && + this->CMakePathName == "PROGRAM") + { + // Executables can be either 32-bit or 64-bit. + expanded = *i; + cmSystemTools::ExpandRegistryValues(expanded, other_view); + cmSystemTools::GlobDirs(expanded.c_str(), finalPath); + } } // clear the path paths.clear(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dce60ff8eb306d824dc3d0fbbdb4937555d0c485..33a7f208f723c4d6d4755ac81d468e990a1758ca 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -72,16 +72,7 @@ cmGlobalGenerator::~cmGlobalGenerator() delete this->ExtraGenerator; } - for (std::map<cmStdString, std::vector<cmTargetExport*> >::iterator - setIt = this->ExportSets.begin(); - setIt != this->ExportSets.end(); - ++setIt) - { - for (unsigned int i = 0; i < setIt->second.size(); ++i) - { - delete setIt->second[i]; - } - } + this->ClearExportSets(); } // Find the make program for the generator, required for try compiles @@ -683,6 +674,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project, void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; + this->ClearExportSets(); // Delete any existing cmLocalGenerators unsigned int i; for (i = 0; i < this->LocalGenerators.size(); ++i) @@ -1232,6 +1224,21 @@ void cmGlobalGenerator::AddTargetToExports(const char* exportSetName, } } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ClearExportSets() +{ + for(std::map<cmStdString, std::vector<cmTargetExport*> >::iterator + setIt = this->ExportSets.begin(); + setIt != this->ExportSets.end(); ++setIt) + { + for(unsigned int i = 0; i < setIt->second.size(); ++i) + { + delete setIt->second[i]; + } + } + this->ExportSets.clear(); +} + const std::vector<cmTargetExport*>* cmGlobalGenerator::GetExportSet( const char* name) const { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7991a338630b0f027a3f073a4e0f720726b78f5b..519158fff3aaac5000fec6cc48fd11a42dc1431c 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -293,6 +293,7 @@ protected: bool InstallTargetEnabled; // Sets of named target exports std::map<cmStdString, std::vector<cmTargetExport*> > ExportSets; + void ClearExportSets(); // Manifest of all targets that will be built for each configuration. // This is computed just before local generators generate. diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 8db09575a2e80dfe613e8127fc599b987d106340..202fe4d02637952e8d7b0e6276ac0fa0d347b319 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -200,6 +200,12 @@ cmInstallTargetGenerator } else { + // Operations done at install time on the installed file should + // be done on the real file and not any of the symlinks. + toInstallPath = this->GetInstallDestination(); + toInstallPath += "/"; + toInstallPath += targetNameReal; + files.push_back(from1); if(targetNameReal != targetName) { diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0a848f6783e8f547a5868540483e3760971160bb..3ee370850d7f7cc6c17c1d91e9bb6013b0b947c6 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -55,7 +55,13 @@ const char* cmSourceFile::GetLanguage() // Perform computation needed to get the language if necessary. if(this->FullPath.empty() && this->Language.empty()) { - if(this->Location.ExtensionIsAmbiguous()) + // If a known extension is given or a known full path is given + // then trust that the current extension is sufficient to + // determine the language. This will fail only if the user + // specifies a full path to the source but leaves off the + // extension, which is kind of weird. + if(this->Location.ExtensionIsAmbiguous() && + this->Location.DirectoryIsAmbiguous()) { // Finalize the file location to get the extension and set the // language. @@ -185,16 +191,6 @@ bool cmSourceFile::FindFullPath() } } - // If the user provided a full path, trust it. If the file is not - // there the native tool will complain at build time. - if(!this->Location.DirectoryIsAmbiguous()) - { - this->FullPath = this->Location.GetDirectory(); - this->FullPath += "/"; - this->FullPath += this->Location.GetName(); - return true; - } - cmOStringStream e; e << "Cannot find source file \"" << this->Location.GetName() << "\""; e << ". Tried extensions"; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 4d25944d4a64a62159cb91dd5462f7904d29d14d..4e1f9453ed2dfb51fecd3cd73d22d257b3d7a083 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -130,7 +130,7 @@ void* cmSystemTools::s_StdoutCallbackClientData = 0; // replace replace with with as many times as it shows up in source. // write the result into source. #if defined(_WIN32) && !defined(__CYGWIN__) -void cmSystemTools::ExpandRegistryValues(std::string& source) +void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64 view) { // Regular expression to match anything inside [...] that begins in HKEY. // Note that there is a special rule for regular expressions to match a @@ -146,7 +146,7 @@ void cmSystemTools::ExpandRegistryValues(std::string& source) // the arguments are the second match std::string key = regEntry.match(1); std::string val; - if (ReadRegistryValue(key.c_str(), val)) + if (ReadRegistryValue(key.c_str(), val, view)) { std::string reg = "["; reg += key + "]"; @@ -161,7 +161,7 @@ void cmSystemTools::ExpandRegistryValues(std::string& source) } } #else -void cmSystemTools::ExpandRegistryValues(std::string& source) +void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64) { cmsys::RegularExpression regEntry("\\[(HKEY[^]]*)\\]"); while (regEntry.find(source)) @@ -2332,9 +2332,14 @@ std::string::size_type cmSystemToolsFindRPath(std::string const& have, bool cmSystemTools::ChangeRPath(std::string const& file, std::string const& oldRPath, std::string const& newRPath, - std::string* emsg) + std::string* emsg, + bool* changed) { #if defined(CMAKE_USE_ELF_PARSER) + if(changed) + { + *changed = false; + } unsigned long rpathPosition = 0; unsigned long rpathSize = 0; std::string rpathPrefix; @@ -2445,6 +2450,10 @@ bool cmSystemTools::ChangeRPath(std::string const& file, // Make sure everything was okay. if(f) { + if(changed) + { + *changed = true; + } return true; } else @@ -2460,6 +2469,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file, (void)oldRPath; (void)newRPath; (void)emsg; + (void)changed; return false; #endif } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 89cf407a2dfdb97941492e932a0e53ed963489bc..493ff714d4afa27ec30a79a58dcc5bc3b28c5bac 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -48,7 +48,8 @@ public: /** * Look for and replace registry values in a string */ - static void ExpandRegistryValues(std::string& source); + static void ExpandRegistryValues(std::string& source, + KeyWOW64 view = KeyWOW64_Default); /** * Platform independent escape spaces, unix uses backslash, @@ -391,7 +392,8 @@ public: static bool ChangeRPath(std::string const& file, std::string const& oldRPath, std::string const& newRPath, - std::string* emsg = 0); + std::string* emsg = 0, + bool* changed = 0); /** Try to remove the RPATH from an ELF binary. */ static bool RemoveRPath(std::string const& file, std::string* emsg = 0); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index d5d530de9fcb4d58902ef15a60bdebbd57b51507..1277d71a4c7ca564ba219fcba6f3c5a832ef9f6c 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -493,6 +493,30 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, free(orig); } +#if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY) +# define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY +# define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY +#else +# define KWSYS_ST_KEY_WOW64_32KEY 0x0200 +# define KWSYS_ST_KEY_WOW64_64KEY 0x0100 +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +static DWORD SystemToolsMakeRegistryMode(DWORD mode, + SystemTools::KeyWOW64 view) +{ + if(view == SystemTools::KeyWOW64_32) + { + return mode | KWSYS_ST_KEY_WOW64_32KEY; + } + else if(view == SystemTools::KeyWOW64_64) + { + return mode | KWSYS_ST_KEY_WOW64_64KEY; + } + return mode; +} +#endif + // Read a registry value. // Example : // HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath @@ -501,7 +525,8 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, // => will return the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value) +bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, + KeyWOW64 view) { bool valueset = false; kwsys_stl::string primary = key; @@ -549,7 +574,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value) if(RegOpenKeyEx(primaryKey, second.c_str(), 0, - KEY_READ, + SystemToolsMakeRegistryMode(KEY_READ, view), &hKey) != ERROR_SUCCESS) { return false; @@ -589,7 +614,8 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value) return valueset; } #else -bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &) +bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &, + KeyWOW64) { return false; } @@ -604,7 +630,8 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &) // => will set the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::WriteRegistryValue(const char *key, const char *value) +bool SystemTools::WriteRegistryValue(const char *key, const char *value, + KeyWOW64 view) { kwsys_stl::string primary = key; kwsys_stl::string second; @@ -654,7 +681,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value) 0, "", REG_OPTION_NON_VOLATILE, - KEY_WRITE, + SystemToolsMakeRegistryMode(KEY_WRITE, view), NULL, &hKey, &dwDummy) != ERROR_SUCCESS) @@ -674,7 +701,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value) return false; } #else -bool SystemTools::WriteRegistryValue(const char *, const char *) +bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64) { return false; } @@ -688,7 +715,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *) // => will delete the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::DeleteRegistryValue(const char *key) +bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) { kwsys_stl::string primary = key; kwsys_stl::string second; @@ -735,7 +762,7 @@ bool SystemTools::DeleteRegistryValue(const char *key) if(RegOpenKeyEx(primaryKey, second.c_str(), 0, - KEY_WRITE, + SystemToolsMakeRegistryMode(KEY_WRITE, view), &hKey) != ERROR_SUCCESS) { return false; @@ -752,7 +779,7 @@ bool SystemTools::DeleteRegistryValue(const char *key) return false; } #else -bool SystemTools::DeleteRegistryValue(const char *) +bool SystemTools::DeleteRegistryValue(const char *, KeyWOW64) { return false; } diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 29f451c9ca2081c0c5ddb4c92172569add46ac2d..1484b60b7e2701e373444240556bfd97f29ef344 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -707,20 +707,30 @@ public: * ----------------------------------------------------------------- */ + /** + * Specify access to the 32-bit or 64-bit application view of + * registry values. The default is to match the currently running + * binary type. + */ + enum KeyWOW64 { KeyWOW64_Default, KeyWOW64_32, KeyWOW64_64 }; + /** * Read a registry value */ - static bool ReadRegistryValue(const char *key, kwsys_stl::string &value); + static bool ReadRegistryValue(const char *key, kwsys_stl::string &value, + KeyWOW64 view = KeyWOW64_Default); /** * Write a registry value */ - static bool WriteRegistryValue(const char *key, const char *value); + static bool WriteRegistryValue(const char *key, const char *value, + KeyWOW64 view = KeyWOW64_Default); /** * Delete a registry value */ - static bool DeleteRegistryValue(const char *key); + static bool DeleteRegistryValue(const char *key, + KeyWOW64 view = KeyWOW64_Default); /** ----------------------------------------------------------------- * Environment Manipulation Routines