From fa4077b016648a9fd90c99fdb782124a9097df71 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 8 Oct 2021 09:14:14 +0900 Subject: [PATCH] Imported Upstream version 3.15.6 --- CompileFlags.cmake | 12 ++++++++-- Modules/CMakeDetermineCompilerId.cmake | 7 +++--- Modules/CMakeParseImplicitIncludeInfo.cmake | 2 +- Modules/FindBLAS.cmake | 8 +++++-- Modules/FindBoost.cmake | 3 +++ Modules/FindGTK2.cmake | 3 +++ Modules/FindPostgreSQL.cmake | 21 ++++++++++++----- Source/CMakeVersion.cmake | 2 +- Source/Modules/CheckCXXLinkerFlag.cmake | 25 +++++++++++++++++++++ Source/cmGlobalVisualStudioVersionedGenerator.cxx | 20 +++++++++-------- Tests/FindPostgreSQL/Test/main.c | 15 ++++++++++--- .../CTestCommandLine/show_only_json_check.pyc | Bin 1829 -> 1829 bytes Tests/RunCMake/FileAPI/check_index.pyc | Bin 8146 -> 8146 bytes 13 files changed, 92 insertions(+), 26 deletions(-) create mode 100644 Source/Modules/CheckCXXLinkerFlag.cmake diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 91f2adf..053259f 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -54,12 +54,20 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc") endif() # Workaround for TOC Overflow on ppc64 +set(bigTocFlag "") if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-bbigtoc") + set(bigTocFlag "-Wl,-bbigtoc") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-multi-toc") + set(bigTocFlag "-Wl,--no-multi-toc") +endif() +if(bigTocFlag) + include(CheckCXXLinkerFlag) + check_cxx_linker_flag(${bigTocFlag} BIG_TOC_FLAG_SUPPORTED) + if(BIG_TOC_FLAG_SUPPORTED) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${bigTocFlag}") + endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d9002fb..edbc23b 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -284,10 +284,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl icl.exe) endif() if(CMAKE_VS_PLATFORM_TOOLSET_VERSION) + set(id_sep "\\") if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20") - set(id_sep ".") - else() - set(id_sep "\\") + if(EXISTS "${CMAKE_GENERATOR_INSTANCE}/VC/Auxiliary/Build.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}/Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props") + set(id_sep ".") + endif() endif() set(id_toolset_version_props "") unset(id_sep) diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 91d03cd..ff4c325 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -167,7 +167,7 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) set(log "") # go through each line of output... - string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") + string(REGEX REPLACE "\r*\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) if(state STREQUAL start) string(FIND "${line}" "#include \"...\" search starts here:" rv) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 77f9d0e..d3acafc 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -481,8 +481,12 @@ if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") "" ) endif() - if(NOT BLAS_LIBRARIES) - find_package(Threads) + if(NOT BLAS_LIBRARIES AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)) + if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) + find_package(Threads) + else() + find_package(Threads REQUIRED) + endif() # OpenBLAS (http://www.openblas.net) check_fortran_libraries( BLAS_LIBRARIES diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 078000f..af4947c 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -449,6 +449,9 @@ if (NOT Boost_NO_BOOST_CMAKE) # Convert component found variables to standard variables if required # Necessary for legacy boost-cmake and 1.70 builtin BoostConfig if(Boost_FIND_COMPONENTS) + # Ignore the meta-component "ALL", introduced by Boost 1.73 + list(REMOVE_ITEM Boost_FIND_COMPONENTS "ALL") + foreach(_comp IN LISTS Boost_FIND_COMPONENTS) if(DEFINED Boost_${_comp}_FOUND) continue() diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index e3af676..83091f3 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -259,6 +259,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) gtkmm-2.4 libglade-2.0 libglademm-2.4 + harfbuzz pango-1.0 pangomm-1.4 sigc++-2.0 @@ -711,6 +712,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (PANGO pango false true) _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib) + _GTK2_FIND_INCLUDE_DIR(HARFBUZZ hb.h) + _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true) _GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib) diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index dfece22..dfdd211 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -205,11 +205,22 @@ if (PostgreSQL_INCLUDE_DIR) endif() endforeach() if (_PostgreSQL_VERSION_NUM) - math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000") - math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000") - set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}") - unset(_PostgreSQL_major_version) - unset(_PostgreSQL_minor_version) + # 9.x and older encoding + if (_PostgreSQL_VERSION_NUM LESS 100000) + math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000") + math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000 / 100") + math(EXPR _PostgreSQL_patch_version "${_PostgreSQL_VERSION_NUM} % 100") + set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}.${_PostgreSQL_patch_version}") + unset(_PostgreSQL_major_version) + unset(_PostgreSQL_minor_version) + unset(_PostgreSQL_patch_version) + else () + math(EXPR _PostgreSQL_major_version "${_PostgreSQL_VERSION_NUM} / 10000") + math(EXPR _PostgreSQL_minor_version "${_PostgreSQL_VERSION_NUM} % 10000") + set(PostgreSQL_VERSION_STRING "${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}") + unset(_PostgreSQL_major_version) + unset(_PostgreSQL_minor_version) + endif () else () foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS}) if(EXISTS "${_PG_CONFIG_HEADER}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3bb8cc3..ba06c4f 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 15) -set(CMake_VERSION_PATCH 5) +set(CMake_VERSION_PATCH 6) #set(CMake_VERSION_RC 0) diff --git a/Source/Modules/CheckCXXLinkerFlag.cmake b/Source/Modules/CheckCXXLinkerFlag.cmake new file mode 100644 index 0000000..9ad2ad6 --- /dev/null +++ b/Source/Modules/CheckCXXLinkerFlag.cmake @@ -0,0 +1,25 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +include_guard(GLOBAL) +include(CheckCXXSourceCompiles) +include(CMakeCheckCompilerFlagCommonPatterns) + +function(check_cxx_linker_flag _flag _var) + set(CMAKE_REQUIRED_LIBRARIES "${_flag}") + + # Normalize locale during test compilation. + set(_locale_vars LC_ALL LC_MESSAGES LANG) + foreach(v IN LISTS _locale_vars) + set(_locale_vars_saved_${v} "$ENV{${v}}") + set(ENV{${v}} C) + endforeach() + check_compiler_flag_common_patterns(_common_patterns) + check_cxx_source_compiles("int main() { return 0; }" ${_var} + ${_common_patterns} + ) + foreach(v IN LISTS _locale_vars) + set(ENV{${v}} ${_locale_vars_saved_${v}}) + endforeach() + set(${_var} "${${_var}}" PARENT_SCOPE) +endfunction() diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 1eca1f6..66a57eb 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -388,15 +388,17 @@ std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const if (version) { std::string instancePath; GetVSInstance(instancePath); - std::stringstream path; - path << instancePath; - path << "/VC/Auxiliary/Build"; - path << (cmSystemTools::VersionCompareGreaterEq(version, "14.20") ? '.' - : '/'); - path << version; - path << "/Microsoft.VCToolsVersion." << version << ".props"; - - std::string toolsetPath = path.str(); + std::string toolsetDir = instancePath + "/VC/Auxiliary/Build"; + char sep = '/'; + if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) { + std::string toolsetDot = toolsetDir + "." + version + + "/Microsoft.VCToolsVersion." + version + ".props"; + if (cmSystemTools::PathExists(toolsetDot)) { + sep = '.'; + } + } + std::string toolsetPath = toolsetDir + sep + version + + "/Microsoft.VCToolsVersion." + version + ".props"; cmSystemTools::ConvertToUnixSlashes(toolsetPath); return toolsetPath; } diff --git a/Tests/FindPostgreSQL/Test/main.c b/Tests/FindPostgreSQL/Test/main.c index 2cfeed0..a63377a 100644 --- a/Tests/FindPostgreSQL/Test/main.c +++ b/Tests/FindPostgreSQL/Test/main.c @@ -5,10 +5,19 @@ int main() { int version = PQlibVersion(); - int major = version / 10000; - int minor = version % 10000; char version_string[100]; - snprintf(version_string, sizeof(version_string), "%d.%d", major, minor); + // 9.x and older encoding. + if (version < 100000) { + int major = version / 10000; + int minor = version % 10000 / 100; + int patch = version % 100; + snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor, + patch); + } else { + int major = version / 10000; + int minor = version % 10000; + snprintf(version_string, sizeof(version_string), "%d.%d", major, minor); + } printf("Found PostgreSQL version %s, expected version %s\n", version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION); return strcmp(version_string, CMAKE_EXPECTED_POSTGRESQL_VERSION); diff --git a/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc b/Tests/RunCMake/CTestCommandLine/show_only_json_check.pyc index 1c49c51c0728b1c5c1b486e57327bfa090e7ed6f..4983bf4cc47ff11fcda7d93f55d1ae3b19a1eb88 100644 GIT binary patch delta 141 zcmZ3=x0H{a`7>O>b(XI_9TbdmWH YGS`vOa`HEpL+C=kS@)p}{bADt09ubJ>O>b(XI_9TbdmWH YGS`vOa`HEpL+C=kS@)p}{bADt0QwRvP5=M^ diff --git a/Tests/RunCMake/FileAPI/check_index.pyc b/Tests/RunCMake/FileAPI/check_index.pyc index b1d5882fa72e6e29836913049cbf20bf54059aec..2ab78376a27944a079e5ced5420107bd8443400d 100644 GIT binary patch delta 365 zcmca)f61Pm`7b;2Xku!cUkL?Zh-Ha1V~EL$ wc{8KiF;h|pUESobQbkD0HWx};pea$G%q_^Z`H2iSy7*=VIV*Ir$=&kq06*VoM*si- delta 365 zcmca)f61Pm`7b;2Xku!cUkL?Zh-Ha1V~EL$ wc{8KiF;h|pUESobQbkD0HWx};pea$G%q_^Z`H2iSy7*=VIV*Ir$=&kq0EU)sV*mgE -- 2.7.4