diff options
70 files changed, 465 insertions, 225 deletions
diff --git a/Auxiliary/bash-completion/cmake b/Auxiliary/bash-completion/cmake index 557f243e30..60611296ec 100644 --- a/Auxiliary/bash-completion/cmake +++ b/Auxiliary/bash-completion/cmake @@ -121,14 +121,19 @@ _cmake() grep -v "^cmake version " )' -- "$cur" ) ) return ;; + --help-manual) + COMPREPLY=( $( compgen -W '$( cmake --help-manual-list 2>/dev/null| + grep -v "^cmake version " | sed -e "s/([0-9])$//" )' -- "$cur" ) ) + return + ;; --help-module) COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null| grep -v "^cmake version " )' -- "$cur" ) ) return ;; --help-policy) - COMPREPLY=( $( compgen -W '$( cmake --help-policies 2>/dev/null | - grep "^ CMP" 2>/dev/null )' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( cmake --help-policy-list 2>/dev/null | + grep -v "^cmake version " )' -- "$cur" ) ) return ;; --help-property) diff --git a/Auxiliary/bash-completion/cpack b/Auxiliary/bash-completion/cpack index 05e0e93ec7..cf5751fa61 100644 --- a/Auxiliary/bash-completion/cpack +++ b/Auxiliary/bash-completion/cpack @@ -48,6 +48,26 @@ _cpack() grep -v "^cpack version " )' -- "$cur" ) ) return ;; + --help-manual) + COMPREPLY=( $( compgen -W '$( cpack --help-manual-list 2>/dev/null| + grep -v "^cpack version " | sed -e "s/([0-9])$//" )' -- "$cur" ) ) + return + ;; + --help-module) + COMPREPLY=( $( compgen -W '$( cpack --help-module-list 2>/dev/null| + grep -v "^cpack version " )' -- "$cur" ) ) + return + ;; + --help-policy) + COMPREPLY=( $( compgen -W '$( cpack --help-policy-list 2>/dev/null | + grep -v "^cpack version " )' -- "$cur" ) ) + return + ;; + --help-property) + COMPREPLY=( $( compgen -W '$( cpack --help-property-list \ + 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) ) + return + ;; --help-variable) COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \ 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) ) diff --git a/Auxiliary/bash-completion/ctest b/Auxiliary/bash-completion/ctest index 387672adfb..49343bb9d6 100644 --- a/Auxiliary/bash-completion/ctest +++ b/Auxiliary/bash-completion/ctest @@ -72,11 +72,37 @@ _ctest() COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) ) return ;; + --help-command) COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null| grep -v "^ctest version " )' -- "$cur" ) ) return ;; + --help-manual) + COMPREPLY=( $( compgen -W '$( ctest --help-manual-list 2>/dev/null| + grep -v "^ctest version " | sed -e "s/([0-9])$//" )' -- "$cur" ) ) + return + ;; + --help-module) + COMPREPLY=( $( compgen -W '$( ctest --help-module-list 2>/dev/null| + grep -v "^ctest version " )' -- "$cur" ) ) + return + ;; + --help-policy) + COMPREPLY=( $( compgen -W '$( ctest --help-policy-list 2>/dev/null | + grep -v "^ctest version " )' -- "$cur" ) ) + return + ;; + --help-property) + COMPREPLY=( $( compgen -W '$( ctest --help-property-list \ + 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) ) + return + ;; + --help-variable) + COMPREPLY=( $( compgen -W '$( ctest --help-variable-list \ + 2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) ) + return + ;; esac if [[ "$cur" == -* ]]; then diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 31e6ec0f33..1eb50f77eb 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -49,6 +49,13 @@ path to the framework ``<fullPath>/A.framework``. When a full path to a framework is used as a library, CMake will use a ``-framework A``, and a ``-F<fullPath>`` to link the framework to the target. +If the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global property is set +all search paths will be tested as normal, with ``32/`` appended, and +with all matches of ``lib/`` replaced with ``lib32/``. This property is +automatically set for the platforms that are known to need it if at +least one of the languages supported by the :command:`project` command +is enabled. + If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set all search paths will be tested as normal, with ``64/`` appended, and with all matches of ``lib/`` replaced with ``lib64/``. This property is diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 3403dcd86e..3574b7fc5a 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -24,6 +24,7 @@ Properties of Global Scope /prop_gbl/DISABLED_FEATURES /prop_gbl/ENABLED_FEATURES /prop_gbl/ENABLED_LANGUAGES + /prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS /prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS /prop_gbl/FIND_LIBRARY_USE_OPENBSD_VERSIONING /prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE diff --git a/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst new file mode 100644 index 0000000000..ce18b650de --- /dev/null +++ b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst @@ -0,0 +1,10 @@ +FIND_LIBRARY_USE_LIB32_PATHS +---------------------------- + +Whether the :command:`find_library` command should automatically search +``lib32`` directories. + +``FIND_LIBRARY_USE_LIB32_PATHS`` is a boolean specifying whether the +:command:`find_library` command should automatically search the ``lib32`` +variant of directories called ``lib`` in the search path when building 32-bit +binaries. diff --git a/Help/release/dev/find-lib32.rst b/Help/release/dev/find-lib32.rst new file mode 100644 index 0000000000..00818dc09d --- /dev/null +++ b/Help/release/dev/find-lib32.rst @@ -0,0 +1,7 @@ +find-lib32 +---------- + +* The :command:`find_library` and :command:`find_package` commands learned + to search in ``lib32/`` directories when the build targets a 32-bit + architecture. See the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global + property. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 644687c01f..33290c4225 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -316,9 +316,13 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + list(APPEND _lib_dirs "lib32/pkgconfig") + endif() get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND _lib_dirs "lib64/pkgconfig") endif() endif() diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index e40a74fabf..1f8c1b4c18 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -50,8 +50,9 @@ set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_ include(Platform/UnixPaths) -# Debian has lib64 paths only for compatibility so they should not be +# Debian has lib32 and lib64 paths only for compatibility so they should not be # searched. if(NOT CMAKE_CROSSCOMPILING AND EXISTS "/etc/debian_version") + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) endif() diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index 7ac6c7e842..6466a0a019 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -18,6 +18,7 @@ endif() set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) # OpenBSD has no multilib +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) # OpenBSD policy requires that shared libraries be installed without diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 20ee1d1114..d6c3d41f31 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -93,5 +93,6 @@ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include ) -# Enable use of lib64 search path variants by default. +# Enable use of lib32 and lib64 search path variants by default. +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65e4a53d59..26702f8922 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160612) +set(CMake_VERSION_PATCH 20160613) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index c1ff526cf4..b47d46e563 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -345,18 +345,21 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent( const std::string& projectName, const std::string& componentName) { ComponentsMap::iterator cit = Components.find(componentName); - if (cit != Components.end()) + if (cit != Components.end()) { return &(cit->second); + } cmCPackComponent* component = cmCPackGenerator::GetComponent(projectName, componentName); - if (!component) + if (!component) { return component; + } std::string name = GetComponentPackageName(component); PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) + if (pit != Packages.end()) { return component; + } cmCPackIFWPackage* package = &Packages[name]; package->Name = name; @@ -387,13 +390,15 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup( { cmCPackComponentGroup* group = cmCPackGenerator::GetComponentGroup(projectName, groupName); - if (!group) + if (!group) { return group; + } std::string name = GetGroupPackageName(group); PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) + if (pit != Packages.end()) { return group; + } cmCPackIFWPackage* package = &Packages[name]; package->Name = name; @@ -462,8 +467,9 @@ std::string cmCPackIFWGenerator::GetGroupPackageName( cmCPackComponentGroup* group) const { std::string name; - if (!group) + if (!group) { return name; + } if (cmCPackIFWPackage* package = GetGroupPackage(group)) { return package->Name; } @@ -488,8 +494,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName( cmCPackComponent* component) const { std::string name; - if (!component) + if (!component) { return name; + } if (cmCPackIFWPackage* package = GetComponentPackage(component)) { return package->Name; } @@ -534,8 +541,9 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( const std::string& repositoryName) { RepositoriesMap::iterator rit = Repositories.find(repositoryName); - if (rit != Repositories.end()) + if (rit != Repositories.end()) { return &(rit->second); + } cmCPackIFWRepository* repository = &Repositories[repositoryName]; repository->Name = repositoryName; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index dfc509bc62..74f6da6712 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles() void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index ad153d1aa1..c44e3897f3 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -71,8 +71,9 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const { - if (Compare.Type == CompareNone) + if (Compare.Type == CompareNone) { return Name; + } std::string result = Name; @@ -128,8 +129,9 @@ bool cmCPackIFWPackage::IsVersionEqual(const char* version) std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component) { - if (!component) + if (!component) { return ""; + } const char* option = GetOption("CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_NAME"); @@ -189,8 +191,9 @@ int cmCPackIFWPackage::ConfigureFromOptions() int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) { - if (!component) + if (!component) { return 0; + } // Restore defaul configuration DefaultConfiguration(); @@ -284,8 +287,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) { - if (!group) + if (!group) { return 0; + } // Restore defaul configuration DefaultConfiguration(); @@ -474,6 +478,7 @@ void cmCPackIFWPackage::GeneratePackageFile() void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 18380054dc..b8a10c64ad 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -89,8 +89,9 @@ bool cmCPackIFWRepository::IsVersionEqual(const char* version) bool cmCPackIFWRepository::ConfigureFromOptions() { // Name; - if (Name.empty()) + if (Name.empty()) { return false; + } std::string prefix = "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_"; @@ -198,8 +199,9 @@ protected: patched = true; } xout.EndElement(); - if (patched) + if (patched) { return; + } if (name == "Checksum") { repository->WriteRepositoryUpdates(xout); patched = true; @@ -209,8 +211,10 @@ protected: virtual void CharacterDataHandler(const char* data, int length) { std::string content(data, data + length); - if (content == "" || content == " " || content == " " || content == "\n") + if (content == "" || content == " " || content == " " || + content == "\n") { return; + } xout.Content(content); } }; @@ -332,6 +336,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout) void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (Generator) + if (Generator) { Generator->WriteGeneratedByToStrim(xout); + } } diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index bef0fb4ff7..b659359c08 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -826,8 +826,9 @@ static int copy_ar(CF* cfp, off_t size) size_t nr, nw; char buf[8 * 1024]; - if (sz == 0) + if (sz == 0) { return 0; + } FILE* from = cfp->rFile; FILE* to = cfp->wFile; @@ -837,16 +838,20 @@ static int copy_ar(CF* cfp, off_t size) : sizeof(buf), from)) > 0) { sz -= nr; - for (size_t off = 0; off < nr; nr -= off, off += nw) - if ((nw = fwrite(buf + off, 1, nr, to)) < nr) + for (size_t off = 0; off < nr; nr -= off, off += nw) { + if ((nw = fwrite(buf + off, 1, nr, to)) < nr) { return -1; + } + } } - if (sz) + if (sz) { return -2; + } if (cfp->flags & WPAD && (size + ar_already_written) & 1 && - fwrite(&pad, 1, 1, to) != 1) + fwrite(&pad, 1, 1, to) != 1) { return -4; + } return 0; } @@ -874,11 +879,11 @@ static int put_arobj(CF* cfp, struct stat* sb) if (gid > USHRT_MAX) { gid = USHRT_MAX; } - if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) + if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) { (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size + lname, ARFMAG); - else { + } else { lname = 0; (void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size, @@ -886,12 +891,14 @@ static int put_arobj(CF* cfp, struct stat* sb) } off_t size = sb->st_size; - if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) + if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) { return -1; + } if (lname) { - if (fwrite(name, 1, lname, cfp->wFile) != lname) + if (fwrite(name, 1, lname, cfp->wFile) != lname) { return -2; + } ar_already_written = lname; } result = copy_ar(cfp, size); diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index dd53be849c..92eb570f58 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -61,8 +61,9 @@ extern "C" int cmBZRXMLParserUnknownEncodingHandler(void*, // workaround for these unknown encodings. if (name == std::string("ascii") || name == std::string("cp1252") || name == std::string("ANSI_X3.4-1968")) { - for (unsigned int i = 0; i < 256; ++i) + for (unsigned int i = 0; i < 256; ++i) { info->map[i] = latin1[i]; + } return 1; } @@ -336,8 +337,9 @@ private: void DoPath(char c0, char c1, char c2, std::string path) { - if (path.empty()) + if (path.empty()) { return; + } cmSystemTools::ConvertToUnixSlashes(path); const std::string dir = cmSystemTools::GetFilenamePath(path); @@ -441,8 +443,9 @@ private: void DoPath(char c0, char c1, char c2, std::string path) { - if (path.empty()) + if (path.empty()) { return; + } cmSystemTools::ConvertToUnixSlashes(path); if (c0 == 'C') { diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index c6cfa44bbe..f1fe3774cf 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -75,8 +75,9 @@ private: void DoPath(char status, std::string const& path) { - if (path.empty()) + if (path.empty()) { return; + } // See "hg help status". Note that there is no 'conflict' status. switch (status) { diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 7b384addbd..ae97d32095 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -413,12 +413,14 @@ void cmCTestMultiProcessHandler::UpdateCostData() std::string line; while (std::getline(fin, line)) { - if (line == "---") + if (line == "---") { break; + } std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); // Format: <name> <previous_runs> <avg_cost> - if (parts.size() < 3) + if (parts.size() < 3) { break; + } std::string name = parts[0]; int prev = atoi(parts[1].c_str()); @@ -464,8 +466,9 @@ void cmCTestMultiProcessHandler::ReadCostData() fin.open(fname.c_str()); std::string line; while (std::getline(fin, line)) { - if (line == "---") + if (line == "---") { break; + } std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); @@ -480,8 +483,9 @@ void cmCTestMultiProcessHandler::ReadCostData() float cost = static_cast<float>(atof(parts[2].c_str())); int index = this->SearchByName(name); - if (index == -1) + if (index == -1) { continue; + } this->Properties[index]->PreviousRuns = prev; // When not running in parallel mode, don't use cost data diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 07f9dadc5a..ede11c9904 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -426,8 +426,9 @@ void cmCTestP4::LoadRevisions() ChangeLists.clear(); this->RunChild(&p4_changes[0], &out, &err); - if (ChangeLists.empty()) + if (ChangeLists.empty()) { return; + } // p4 describe -s ...@1111111,2222222 std::vector<char const*> p4_describe; diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index a6885aa26f..fa014111b8 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -271,8 +271,9 @@ bool cmCTestSVN::UpdateImpl() bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters, OutputParser* out, OutputParser* err) { - if (parameters.empty()) + if (parameters.empty()) { return false; + } std::vector<char const*> args; args.push_back(this->CommandLineTool.c_str()); diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 84672ae070..d03d3300d8 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -54,9 +54,9 @@ void cmCursesLongMessageForm::UpdateStatusBar() size = cmCursesMainForm::MAX_WIDTH - 1; } strncpy(bar, this->Title.c_str(), size); - for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) + for (size_t i = size - 1; i < cmCursesMainForm::MAX_WIDTH; i++) { bar[i] = ' '; - + } int width; if (x < cmCursesMainForm::MAX_WIDTH) { width = x; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 676e84a2a0..9adfdafaef 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -71,8 +71,9 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, while (*realbuffer != '0' && (*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\r' || *realbuffer == '\n')) { - if (*realbuffer == '\n') + if (*realbuffer == '\n') { lineno++; + } realbuffer++; } // skip blank lines and comment lines diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 131b490d67..b893dd3aba 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -246,19 +246,11 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l) ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); if (i == this->DefinesByLanguage.end()) { std::set<std::string> defines; - const char* lang = l.c_str(); - // Add the export symbol definition for shared library objects. - if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro); - } - - // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AddCompileDefinitions( - defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(), - l); + this->LocalGenerator->GetTargetDefines(this->GeneratorTarget, + this->ConfigName, l, defines); std::string definesString; - this->LocalGenerator->JoinDefines(defines, definesString, lang); + this->LocalGenerator->JoinDefines(defines, definesString, l); ByLanguageMap::value_type entry(l, definesString); i = this->DefinesByLanguage.insert(entry).first; diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index f81bf068df..57e719cc8a 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -158,7 +158,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, this->HeaderLocationCache.find(current.FileName); if (headerLocationIt != this->HeaderLocationCache.end()) { fullName = headerLocationIt->second; - } else + } else { for (std::vector<std::string>::const_iterator i = this->IncludePath.begin(); i != this->IncludePath.end(); ++i) { @@ -175,6 +175,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, break; } } + } } // Complain if the file cannot be found and matches the complain diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index a4d4dbbfeb..3094fcf40c 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -40,11 +40,10 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn, return true; } - if (const char* abi_name = - this->Makefile->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { - std::string abi = abi_name; - if (abi.find("ELF N32") != abi.npos) { - // Convert lib to lib32. + if (this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB32_PATHS")) { + // add special 32 bit paths if this is a 32 bit compile. + if (this->Makefile->PlatformIs32Bit()) { this->AddArchitecturePaths("32"); } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7908afe958..1a44d73dc4 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -43,6 +43,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->UseConfigFiles = true; this->UseFindModules = true; this->DebugMode = false; + this->UseLib32Paths = false; this->UseLib64Paths = false; this->PolicyScope = true; this->VersionMajor = 0; @@ -110,6 +111,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args, this->LibraryArchitecture = arch; } + // Lookup whether lib32 paths should be used. + if (this->Makefile->PlatformIs32Bit() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB32_PATHS")) { + this->UseLib32Paths = true; + } + // Lookup whether lib64 paths should be used. if (this->Makefile->PlatformIs64Bit() && this->Makefile->GetState()->GetGlobalPropertyAsBool( @@ -1907,6 +1915,9 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) if (!this->LibraryArchitecture.empty()) { common.push_back("lib/" + this->LibraryArchitecture); } + if (this->UseLib32Paths) { + common.push_back("lib32"); + } if (this->UseLib64Paths) { common.push_back("lib64"); } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index eff6b80901..9019f1b041 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -148,6 +148,7 @@ private: bool NoUserRegistry; bool NoSystemRegistry; bool DebugMode; + bool UseLib32Paths; bool UseLib64Paths; bool PolicyScope; std::string LibraryArchitecture; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1607dd937a..de02395bc6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1348,8 +1348,9 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, fpath += ".app"; if (!this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) + if (!contentOnly) { fpath += "/MacOS"; + } } return fpath; } @@ -1377,8 +1378,9 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, fpath += ext; if (!this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) + if (!contentOnly) { fpath += "/MacOS"; + } } return fpath; } @@ -3336,11 +3338,13 @@ static std::string intersect(const std::set<std::string>& s1, { std::string result; result = intersect(s1, s2); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s3); - if (!result.empty()) + if (!result.empty()) { return result; + } return intersect(s2, s3); } @@ -3351,14 +3355,17 @@ static std::string intersect(const std::set<std::string>& s1, { std::string result; result = intersect(s1, s2); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s3); - if (!result.empty()) + if (!result.empty()) { return result; + } result = intersect(s1, s4); - if (!result.empty()) + if (!result.empty()) { return result; + } return intersect(s2, s3, s4); } diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 640497ab81..7d4fe2ce85 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -51,8 +51,9 @@ public: virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, cmake* cm) const { - if (name != T::GetActualName()) + if (name != T::GetActualName()) { return 0; + } return new T(cm); } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3abcba3987..f74e83562a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -30,8 +30,9 @@ const char* cmGlobalNinjaGenerator::INDENT = " "; void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count) { - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { os << cmGlobalNinjaGenerator::INDENT; + } } void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os) @@ -43,8 +44,9 @@ void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os) void cmGlobalNinjaGenerator::WriteComment(std::ostream& os, const std::string& comment) { - if (comment.empty()) + if (comment.empty()) { return; + } std::string::size_type lpos = 0; std::string::size_type rpos; @@ -165,16 +167,18 @@ void cmGlobalNinjaGenerator::WriteBuild( if (!implicitDeps.empty()) { arguments += " |"; for (cmNinjaDeps::const_iterator i = implicitDeps.begin(); - i != implicitDeps.end(); ++i) + i != implicitDeps.end(); ++i) { arguments += " " + EncodeIdent(EncodePath(*i), os); + } } // Write order-only dependencies. if (!orderOnlyDeps.empty()) { arguments += " ||"; for (cmNinjaDeps::const_iterator i = orderOnlyDeps.begin(); - i != orderOnlyDeps.end(); ++i) + i != orderOnlyDeps.end(); ++i) { arguments += " " + EncodeIdent(EncodePath(*i), os); + } } arguments += "\n"; @@ -198,9 +202,10 @@ void cmGlobalNinjaGenerator::WriteBuild( // Write the variables bound to this build statement. std::ostringstream variable_assignments; for (cmNinjaVars::const_iterator i = variables.begin(); i != variables.end(); - ++i) + ++i) { cmGlobalNinjaGenerator::WriteVariable(variable_assignments, i->first, i->second, "", 1); + } // check if a response file rule should be used std::string buildstr = build; @@ -430,8 +435,9 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os, cmGlobalNinjaGenerator::WriteComment(os, comment); os << "default"; for (cmNinjaDeps::const_iterator i = targets.begin(); i != targets.end(); - ++i) + ++i) { os << " " << *i; + } os << "\n"; } @@ -907,15 +913,17 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, this->AppendTargetOutputs(target, outputs); // Mark the target's outputs as ambiguous to ensure that no other target uses // the output as an alias. - for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) + for (cmNinjaDeps::iterator i = outputs.begin(); i != outputs.end(); ++i) { TargetAliases[*i] = 0; + } // Insert the alias into the map. If the alias was already present in the // map and referred to another target, mark it as ambiguous. std::pair<TargetAliasMap::iterator, bool> newAlias = TargetAliases.insert(std::make_pair(buildAlias, target)); - if (newAlias.second && newAlias.first->second != target) + if (newAlias.second && newAlias.first->second != target) { newAlias.first->second = 0; + } } void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) @@ -926,8 +934,9 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) for (TargetAliasMap::const_iterator i = TargetAliases.begin(); i != TargetAliases.end(); ++i) { // Don't write ambiguous aliases. - if (!i->second) + if (!i->second) { continue; + } cmNinjaDeps deps; this->AppendTargetOutputs(i->second, deps); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 759e06cd51..2f50b7f4cb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -944,7 +944,7 @@ std::string cmLocalGenerator::GetIncludeFlags( void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines, cmGeneratorTarget const* target, const std::string& config, - const std::string& lang) + const std::string& lang) const { std::vector<std::string> targetDefines; target->GetCompileDefinitions(targetDefines, config, lang); @@ -1330,6 +1330,20 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, return ::GetFrameworkFlags(l, config, target); } +void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, + std::string const& config, + std::string const& lang, + std::set<std::string>& defines) const +{ + // Add the export symbol definition for shared library objects. + if (const char* exportMacro = target->GetExportMacro()) { + this->AppendDefines(defines, exportMacro); + } + + // Add preprocessor definitions for this target and configuration. + this->AddCompileDefinitions(defines, target, config, lang.c_str()); +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { @@ -2052,7 +2066,7 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags, } void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, - const char* defines_list) + const char* defines_list) const { // Short-circuit if there are no definitions. if (!defines_list) { @@ -2066,7 +2080,8 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, } void cmLocalGenerator::AppendDefines( - std::set<std::string>& defines, const std::vector<std::string>& defines_vec) + std::set<std::string>& defines, + const std::vector<std::string>& defines_vec) const { for (std::vector<std::string>::const_iterator di = defines_vec.begin(); di != defines_vec.end(); ++di) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 8e5563caaf..af561f6874 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -138,13 +138,15 @@ public: * Encode a list of preprocessor definitions for the compiler * command line. */ - void AppendDefines(std::set<std::string>& defines, const char* defines_list); - void AppendDefines(std::set<std::string>& defines, std::string defines_list) + void AppendDefines(std::set<std::string>& defines, + const char* defines_list) const; + void AppendDefines(std::set<std::string>& defines, + std::string defines_list) const { this->AppendDefines(defines, defines_list.c_str()); } void AppendDefines(std::set<std::string>& defines, - const std::vector<std::string>& defines_vec); + const std::vector<std::string>& defines_vec) const; /** * Join a set of defines into a definesString with a space separator. @@ -200,7 +202,7 @@ public: void AddCompileDefinitions(std::set<std::string>& defines, cmGeneratorTarget const* target, const std::string& config, - const std::string& lang); + const std::string& lang) const; std::string GetProjectName() const; @@ -312,6 +314,9 @@ public: std::string& flags, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target, bool useWatcomQuote); + void GetTargetDefines(cmGeneratorTarget const* target, + std::string const& config, std::string const& lang, + std::set<std::string>& defines) const; std::string GetFrameworkFlags(std::string const& l, std::string const& config, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6c231c3ec5..6e676f1d3f 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -81,8 +81,9 @@ void cmLocalNinjaGenerator::Generate() tg->Generate(); // Add the target to "all" if required. if (!this->GetGlobalNinjaGenerator()->IsExcluded( - this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) + this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], *t)) { this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t); + } delete tg; } } @@ -257,8 +258,9 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) os << "# Write statements declared in CMakeLists.txt:" << std::endl << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; - if (this->IsRootMakefile()) + if (this->IsRootMakefile()) { os << "# Which is the root file." << std::endl; + } cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; } @@ -282,9 +284,10 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps( for (std::vector<std::string>::const_iterator i = deps.begin(); i != deps.end(); ++i) { std::string dep; - if (this->GetRealDependency(*i, this->GetConfigName(), dep)) + if (this->GetRealDependency(*i, this->GetConfigName(), dep)) { ninjaDeps.push_back( this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(dep)); + } } } @@ -294,12 +297,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine( // If we have no commands but we need to build a command anyway, use ":". // This happens when building a POST_BUILD value for link targets that // don't use POST_BUILD. - if (cmdLines.empty()) + if (cmdLines.empty()) { #ifdef _WIN32 return "cd ."; #else return ":"; #endif + } std::ostringstream cmd; for (std::vector<std::string>::const_iterator li = cmdLines.begin(); @@ -332,8 +336,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( { if (ccg.GetNumberOfCommands() > 0) { std::string wd = ccg.GetWorkingDirectory(); - if (wd.empty()) + if (wd.empty()) { wd = this->GetCurrentBinaryDirectory(); + } std::ostringstream cdCmd; #ifdef _WIN32 @@ -361,8 +366,9 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps) { - if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) + if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) { return; + } cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this); @@ -391,8 +397,9 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->AppendCustomCommandDeps(ccg, ninjaDeps); for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end(); - ++i) + ++i) { this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i); + } std::vector<std::string> cmdLines; this->AppendCustomCommandLines(ccg, cmdLines); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fe3194073c..c72c95cc06 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2080,6 +2080,14 @@ bool cmMakefile::IsSet(const std::string& name) const return true; } +bool cmMakefile::PlatformIs32Bit() const +{ + if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) { + return atoi(sizeof_dptr) == 4; + } + return false; +} + bool cmMakefile::PlatformIs64Bit() const { if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) { @@ -3624,8 +3632,9 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, bool cmMakefile::IsAlias(const std::string& name) const { - if (this->AliasTargets.find(name) != this->AliasTargets.end()) + if (this->AliasTargets.find(name) != this->AliasTargets.end()) { return true; + } return this->GetGlobalGenerator()->IsAlias(name); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4fc197dd68..81c3f71d55 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -437,6 +437,9 @@ public: bool IsOn(const std::string& name) const; bool IsSet(const std::string& name) const; + /** Return whether the target platform is 32-bit. */ + bool PlatformIs32Bit() const; + /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; @@ -643,8 +646,9 @@ public: void AddInstallGenerator(cmInstallGenerator* g) { - if (g) + if (g) { this->InstallGenerators.push_back(g); + } } std::vector<cmInstallGenerator*>& GetInstallGenerators() { @@ -653,8 +657,9 @@ public: void AddTestGenerator(cmTestGenerator* g) { - if (g) + if (g) { this->TestGenerators.push_back(g); + } } const std::vector<cmTestGenerator*>& GetTestGenerators() const { diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 0998eb8110..438f90f3d7 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -329,8 +329,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( buildEcho += " shared library "; break; case cmState::MODULE_LIBRARY: - if (this->GeneratorTarget->IsCFBundleOnApple()) + if (this->GeneratorTarget->IsCFBundleOnApple()) { buildEcho += " CFBundle"; + } buildEcho += " shared module "; break; default: diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f4458a7dac..dab90c9144 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -24,7 +24,6 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args, cmake::MessageType type = cmake::MESSAGE; bool status = false; bool fatal = false; - cmake* cm = this->Makefile->GetCMakeInstance(); if (*i == "SEND_ERROR") { type = cmake::FATAL_ERROR; ++i; @@ -36,10 +35,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args, type = cmake::WARNING; ++i; } else if (*i == "AUTHOR_WARNING") { - if (cm->GetDevWarningsAsErrors(this->Makefile)) { + if (this->Makefile->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && + !this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")) { fatal = true; type = cmake::AUTHOR_ERROR; - } else if (!cm->GetSuppressDevWarnings(this->Makefile)) { + } else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { type = cmake::AUTHOR_WARNING; } else { return true; @@ -49,10 +49,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args, status = true; ++i; } else if (*i == "DEPRECATION") { - if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) { + if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) { fatal = true; type = cmake::DEPRECATION_ERROR; - } else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) { + } else if ((!this->Makefile->IsSet("CMAKE_WARN_DEPRECATED") || + this->Makefile->IsOn("CMAKE_WARN_DEPRECATED"))) { type = cmake::DEPRECATION_WARNING; } else { return true; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index fdce542ccb..5225e3ff08 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -41,15 +41,16 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator( , TargetLinkLanguage("") { this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName()); - if (target->GetType() == cmState::EXECUTABLE) + if (target->GetType() == cmState::EXECUTABLE) { this->GetGeneratorTarget()->GetExecutableNames( this->TargetNameOut, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, GetLocalGenerator()->GetConfigName()); - else + } else { this->GetGeneratorTarget()->GetLibraryNames( this->TargetNameOut, this->TargetNameSO, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, GetLocalGenerator()->GetConfigName()); + } if (target->GetType() != cmState::OBJECT_LIBRARY) { // on Windows the output dir is already needed at compile time @@ -125,10 +126,11 @@ const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const case cmState::SHARED_LIBRARY: return "shared library"; case cmState::MODULE_LIBRARY: - if (this->GetGeneratorTarget()->IsCFBundleOnApple()) + if (this->GetGeneratorTarget()->IsCFBundleOnApple()) { return "CFBundle shared module"; - else + } else { return "shared module"; + } case cmState::EXECUTABLE: return "executable"; default: @@ -271,7 +273,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); - if (targetType == cmState::EXECUTABLE) + if (targetType == cmState::EXECUTABLE) { this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_EXECUTABLE", cmakeCommand + " -E cmake_symlink_executable" @@ -284,7 +286,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) /*rspcontent*/ "", /*restat*/ "", /*generator*/ false); - else + } else { this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_LIBRARY", cmakeCommand + " -E cmake_symlink_library" @@ -297,6 +299,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) /*rspcontent*/ "", /*restat*/ "", /*generator*/ false); + } } } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b0f0d9b47c..05a0a63927 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -46,8 +46,9 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) // (i.e. top-level) directory. CMake creates copies of these targets // in every directory, which we don't need. if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(), - target->GetLocalGenerator()->GetSourceDirectory()) == 0) + target->GetLocalGenerator()->GetSourceDirectory()) == 0) { return new cmNinjaUtilityTargetGenerator(target); + } // else fallthrough } @@ -132,8 +133,9 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, includes, this->GeneratorTarget, language, language == "RC", // full include paths for RC needed by cmcldeps false, this->GetConfigName()); - if (this->GetGlobalGenerator()->IsGCCOnWindows()) + if (this->GetGlobalGenerator()->IsGCCOnWindows()) { std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/'); + } this->LocalGenerator->AppendFlags(languageFlags, includeFlags); } @@ -170,13 +172,15 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const { // Static libraries never depend on other targets for linking. if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) + this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) { return cmNinjaDeps(); + } cmComputeLinkInformation* cli = this->GeneratorTarget->GetLinkInformation(this->GetConfigName()); - if (!cli) + if (!cli) { return cmNinjaDeps(); + } const std::vector<std::string>& deps = cli->GetDepends(); cmNinjaDeps result(deps.size()); @@ -218,8 +222,9 @@ std::string cmNinjaTargetGenerator::GetObjectFilePath( cmSourceFile const* source) const { std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); - if (!path.empty()) + if (!path.empty()) { path += "/"; + } std::string const& objectName = this->GeneratorTarget->GetObjectName(source); path += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); path += "/"; @@ -237,8 +242,9 @@ std::string cmNinjaTargetGenerator::GetTargetFilePath( const std::string& name) const { std::string path = this->GetTargetOutputDir(); - if (path.empty() || path == ".") + if (path.empty() || path == ".") { return name; + } path += "/"; path += name; return path; @@ -420,8 +426,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) } for (std::vector<std::string>::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) + i != compileCmds.end(); ++i) { this->GetLocalGenerator()->ExpandRuleVariables(*i, vars); + } std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(compileCmds); @@ -653,8 +660,9 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( cmSystemTools::ExpandListArgument(compileCmd, compileCmds); for (std::vector<std::string>::iterator i = compileCmds.begin(); - i != compileCmds.end(); ++i) + i != compileCmds.end(); ++i) { this->GetLocalGenerator()->ExpandRuleVariables(*i, compileObjectVars); + } std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine(compileCmds); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index f7a7f38c84..c549646715 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -57,8 +57,9 @@ void cmNinjaUtilityTargetGenerator::Generate() std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); std::transform(ccByproducts.begin(), ccByproducts.end(), std::back_inserter(util_outputs), MapToNinjaPath()); - if (ci->GetUsesTerminal()) + if (ci->GetUsesTerminal()) { uses_terminal = true; + } } } @@ -99,10 +100,11 @@ void cmNinjaUtilityTargetGenerator::Generate() const char* echoStr = this->GetGeneratorTarget()->GetProperty("EchoString"); std::string desc; - if (echoStr) + if (echoStr) { desc = echoStr; - else + } else { desc = "Running utility command for " + this->GetTargetName(); + } // TODO: fix problematic global targets. For now, search and replace the // makefile vars. @@ -122,8 +124,9 @@ void cmNinjaUtilityTargetGenerator::Generate() .c_str()); cmSystemTools::ReplaceString(command, "$(ARGS)", ""); - if (command.find('$') != std::string::npos) + if (command.find('$') != std::string::npos) { return; + } for (cmNinjaDeps::const_iterator oi = util_outputs.begin(), oe = util_outputs.end(); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index f62ba40cc1..c19cae0d00 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -25,8 +25,9 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target, , ConfigName(configName) , MacContentFolders(0) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } } bool cmOSXBundleGenerator::MustSkip() @@ -37,8 +38,9 @@ bool cmOSXBundleGenerator::MustSkip() void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, std::string& outpath) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } // Compute bundle directory names. std::string out = outpath; @@ -64,8 +66,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, const std::string& outpath) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } assert(this->MacContentFolders); @@ -92,8 +95,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, plist.c_str()); // Generate Versions directory only for MacOSX frameworks - if (this->Makefile->PlatformIsAppleIos()) + if (this->Makefile->PlatformIsAppleIos()) { return; + } // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to // drive rules to create these files at build time. @@ -162,8 +166,9 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, const std::string& root) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } // Compute bundle directory names. std::string out = root; @@ -186,8 +191,9 @@ void cmOSXBundleGenerator::GenerateMacOSXContentStatements( std::vector<cmSourceFile const*> const& sources, MacOSXContentGeneratorType* generator) { - if (this->MustSkip()) + if (this->MustSkip()) { return; + } for (std::vector<cmSourceFile const*>::const_iterator si = sources.begin(); si != sources.end(); ++si) { diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 6669e5c12d..d3bf301c3a 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -75,17 +75,21 @@ struct cmDocumentationEntry cmDocumentationEntry() {} cmDocumentationEntry(const char* doc[2]) { - if (doc[0]) + if (doc[0]) { this->Name = doc[0]; - if (doc[1]) + } + if (doc[1]) { this->Brief = doc[1]; + } } cmDocumentationEntry(const char* n, const char* b) { - if (n) + if (n) { this->Name = n; - if (b) + } + if (b) { this->Brief = b; + } } }; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 10c68d1932..26cbfb6bff 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -228,14 +228,16 @@ std::string cmSystemTools::HelpFileName(std::string name) std::string cmSystemTools::TrimWhitespace(const std::string& s) { std::string::const_iterator start = s.begin(); - while (start != s.end() && cm_isspace(*start)) + while (start != s.end() && cm_isspace(*start)) { ++start; - if (start == s.end()) + } + if (start == s.end()) { return ""; - + } std::string::const_iterator stop = s.end() - 1; - while (cm_isspace(*stop)) + while (cm_isspace(*stop)) { --stop; + } return std::string(start, stop + 1); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index da2a64993d..55da611f8e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -287,8 +287,9 @@ cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( { std::map<std::string, cmListFileBacktrace>::const_iterator i = this->UtilityBacktraces.find(u); - if (i == this->UtilityBacktraces.end()) + if (i == this->UtilityBacktraces.end()) { return 0; + } return &i->second; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ecbdc61a81..98ac518f6a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2447,19 +2447,11 @@ void cmake::RunCheckForUnusedVariables() #endif } -bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) const -{ - /* - * The suppression CMake variable may be set in the CMake configuration file - * itself, so we have to check what its set to in the makefile if we can. - */ - if (mf) { - return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - return cmSystemTools::IsOn(cacheEntryValue); - } +bool cmake::GetSuppressDevWarnings() const +{ + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetSuppressDevWarnings(bool b) @@ -2481,20 +2473,11 @@ void cmake::SetSuppressDevWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) const +bool cmake::GetSuppressDeprecatedWarnings() const { - /* - * The suppression CMake variable may be set in the CMake configuration file - * itself, so we have to check what its set to in the makefile if we can. - */ - if (mf) { - return (mf->IsSet("CMAKE_WARN_DEPRECATED") && - !mf->IsOn("CMAKE_WARN_DEPRECATED")); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetSuppressDeprecatedWarnings(bool b) @@ -2516,16 +2499,11 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDevWarningsAsErrors() const { - if (mf) { - return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && - !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetDevWarningsAsErrors(bool b) @@ -2547,15 +2525,11 @@ void cmake::SetDevWarningsAsErrors(bool b) cmState::INTERNAL); } -bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDeprecatedWarningsAsErrors() const { - if (mf) { - return mf->IsOn("CMAKE_ERROR_DEPRECATED"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - return cmSystemTools::IsOn(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetDeprecatedWarningsAsErrors(bool b) diff --git a/Source/cmake.h b/Source/cmake.h index 4958a05dc6..aa1ff2caf1 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -339,7 +339,7 @@ public: * Returns false, by default, if developer warnings should be shown, true * otherwise. */ - bool GetSuppressDevWarnings(cmMakefile const* mf = NULL) const; + bool GetSuppressDevWarnings() const; /* * Set the state of the suppression of developer (author) warnings. */ @@ -350,7 +350,7 @@ public: * Returns false, by default, if deprecated warnings should be shown, true * otherwise. */ - bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL) const; + bool GetSuppressDeprecatedWarnings() const; /* * Set the state of the suppression of deprecated warnings. */ @@ -361,7 +361,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL) const; + bool GetDevWarningsAsErrors() const; /** * Set the state of treating developer (author) warnings as errors. */ @@ -372,7 +372,7 @@ public: * Returns false, by default, if warnings should not be treated as errors, * true otherwise. */ - bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL) const; + bool GetDeprecatedWarningsAsErrors() const; /** * Set the state of treating developer (author) warnings as errors. */ diff --git a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in index b141942c15..e2cdec89ab 100644 --- a/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in +++ b/Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in @@ -4,8 +4,7 @@ #define RETVAL @_retval@ -int -main(int ac, char **av) +int main(int ac, char** av) { cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments::Main(ac, av); @@ -16,42 +15,39 @@ main(int ac, char **av) std::string logarg; bool nextarg = false; - if (exename.find("valgrind") != exename.npos) + if (exename.find("valgrind") != exename.npos) { logarg = "--log-file="; - else if (exename.find("purify") != exename.npos) + } else if (exename.find("purify") != exename.npos) { #ifdef _WIN32 logarg = "/SAVETEXTDATA="; #else logarg = "-log-file="; #endif - else if (exename.find("BC") != exename.npos) - { + } else if (exename.find("BC") != exename.npos) { nextarg = true; logarg = "/X"; - } + } if (!logarg.empty()) { std::string logfile; for (int i = 1; i < argc; i++) { std::string arg = argv[i]; - if (arg.find(logarg) == 0) - { - if (nextarg) - { - if (i == argc - 1) + if (arg.find(logarg) == 0) { + if (nextarg) { + if (i == argc - 1) { return 1; // invalid command line - logfile = argv[i + 1]; } - else - { + logfile = argv[i + 1]; + } else { logfile = arg.substr(logarg.length()); - } - // keep searching, it may be overridden later to provoke an error } + // keep searching, it may be overridden later to provoke an error } + } - if (!logfile.empty()) + if (!logfile.empty()) { cmSystemTools::Touch(logfile, true); + } } return RETVAL; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 1cfd3815ad..b811c7fd5a 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -46,10 +46,12 @@ private: void ParseTranslationUnit() { this->Command = CommandType(); - if (!Expect('{')) + if (!Expect('{')) { return; - if (Expect('}')) + } + if (Expect('}')) { return; + } do { ParseString(); std::string name = this->String; @@ -64,8 +66,9 @@ private: void ParseString() { this->String = ""; - if (!Expect('"')) + if (!Expect('"')) { return; + } while (!Expect('"')) { Expect('\\'); this->String.append(1, C); @@ -84,8 +87,9 @@ private: void ExpectOrDie(char c, const std::string& message) { - if (!Expect(c)) + if (!Expect(c)) { ErrorExit(std::string("'") + c + "' expected " + message + "."); + } } void NextNonWhitespace() @@ -98,8 +102,9 @@ private: void Next() { this->C = char(Input->get()); - if (this->Input->bad()) + if (this->Input->bad()) { ErrorExit("Unexpected end of file."); + } } void ErrorExit(const std::string& message) diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index 2d4ecaf140..995865068a 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -33,16 +33,23 @@ endmacro() set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) set(CMAKE_SIZEOF_VOID_P 4) foreach(lib + lib/32/libtest5.a lib/A/lib/libtest1.a + lib/A/lib32/libtest3.a lib/A/libtest1.a lib/libtest1.a lib/libtest2.a lib/libtest3.a lib/libtest3.a + lib32/A/lib/libtest2.a + lib32/A/lib32/libtest4.a + lib32/A/libtest4.a + lib32/libtest4.a ) test_find_library_subst(${lib}) endforeach() diff --git a/Tests/CMakeOnly/find_library/lib/32/libtest5.a b/Tests/CMakeOnly/find_library/lib/32/libtest5.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/32/libtest5.a diff --git a/Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a b/Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/A/lib32/libtest3.a diff --git a/Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib32/A/lib/libtest2.a diff --git a/Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a b/Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib32/A/lib32/libtest4.a diff --git a/Tests/CMakeOnly/find_library/lib32/A/libtest4.a b/Tests/CMakeOnly/find_library/lib32/A/libtest4.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib32/A/libtest4.a diff --git a/Tests/CMakeOnly/find_library/lib32/libtest4.a b/Tests/CMakeOnly/find_library/lib32/libtest4.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib32/libtest4.a diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake index 9d4826fa84..4a4153391c 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_APPBUNDLE_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake index d9943d4fe5..b66d02f1a7 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_CMAKE_FRAMEWORK_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake index 89ce4c6d86..25a775d7fe 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -1,6 +1,3 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS -enable_language(C) - # Prepare environment and variables set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index c903279554..bdecb8ae6a 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS propertie + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake index a52bcbf813..df67235974 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake index 2fabe5b430..1351b6fbf3 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -1,4 +1,4 @@ -# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE, FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS enable_language(C) # Prepare environment and variables @@ -29,10 +29,15 @@ if(NOT DEFINED CMAKE_SYSTEM_NAME set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() else() - # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS and FIND_LIBRARY_USE_LIB32_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64) + if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib32/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + elseif(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") endif() endif() else() diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-bar/lib32/pkgconfig/.placeholder diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-foo/lib32/pkgconfig/.placeholder diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 94896930a9..2346c86754 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(defaultmessage) run_cmake(nomessage) +run_cmake(message-internal-warning) +run_cmake(nomessage-internal-warning) run_cmake(warnmessage) # message command sets fatal occurred flag, so check each type of error diff --git a/Tests/RunCMake/message/message-internal-warning-stderr.txt b/Tests/RunCMake/message/message-internal-warning-stderr.txt new file mode 100644 index 0000000000..25946e9b2f --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\) in message-internal-warning.cmake: + A logical block opening on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:4 \(macro\) + + closes on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:5 \(endmacro\) + + with mis-matching arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/message/message-internal-warning.cmake b/Tests/RunCMake/message/message-internal-warning.cmake new file mode 100644 index 0000000000..33993c7ffc --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) + +macro(mymacro) +endmacro(notmymacro) diff --git a/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt b/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt diff --git a/Tests/RunCMake/message/nomessage-internal-warning.cmake b/Tests/RunCMake/message/nomessage-internal-warning.cmake new file mode 100644 index 0000000000..3ec2e28d78 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON CACHE BOOL "") + +macro(mymacro) +endmacro(notmymacro) |