diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckPIESupported.cmake | 11 | ||||
-rw-r--r-- | Modules/FindGLUT.cmake | 5 | ||||
-rw-r--r-- | Modules/FindPostgreSQL.cmake | 4 | ||||
-rw-r--r-- | Modules/Internal/HeaderpadWorkaround.cmake | 69 |
4 files changed, 82 insertions, 7 deletions
diff --git a/Modules/CheckPIESupported.cmake b/Modules/CheckPIESupported.cmake index 6424472..452348b 100644 --- a/Modules/CheckPIESupported.cmake +++ b/Modules/CheckPIESupported.cmake @@ -22,10 +22,13 @@ property for executables will be honored at link time. Options are: ``OUTPUT_VARIABLE <output>`` - Set ``<output>`` variable with details about any error. + Set ``<output>`` variable with details about any error. If the check is + bypassed because it uses cached results from a previous call, the output + will be empty even if errors were present in the previous call. ``LANGUAGES <lang>...`` Check the linkers used for each of the specified languages. + If this option is not provided, the command checks all enabled languages. ``C``, ``CXX``, ``Fortran`` are supported. @@ -43,9 +46,9 @@ Variables For each language checked, two boolean cache variables are defined. ``CMAKE_<lang>_LINK_PIE_SUPPORTED`` - Set to ``YES`` if ``PIE`` is supported by the linker and ``NO`` otherwise. + Set to true if ``PIE`` is supported by the linker and false otherwise. ``CMAKE_<lang>_LINK_NO_PIE_SUPPORTED`` - Set to ``YES`` if ``NO_PIE`` is supported by the linker and ``NO`` otherwise. + Set to true if ``NO_PIE`` is supported by the linker and false otherwise. Examples ^^^^^^^^ @@ -139,7 +142,7 @@ function (check_pie_supported) # no support at link time. Set cache variables to NO set(CMAKE_${lang}_LINK_PIE_SUPPORTED NO CACHE INTERNAL "PIE (${lang})") set(CMAKE_${lang}_LINK_NO_PIE_SUPPORTED NO CACHE INTERNAL "NO_PIE (${lang})") - string (APPEND outputs "PIE and NO_PIE are not supported by linker for ${lang}") + string (APPEND outputs "PIE and NO_PIE are not supported by linker for ${lang}\n") endif() endforeach() diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index 7a16048..43041c5 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -97,6 +97,9 @@ endfunction() find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) pkg_check_modules(GLUT QUIET glut) + if(NOT GLUT_FOUND) + pkg_check_modules(GLUT QUIET freeglut) + endif() if(GLUT_FOUND) # GLUT_INCLUDE_DIRS is now the official result variable, but # older versions of CMake only provided GLUT_INCLUDE_DIR. @@ -111,7 +114,7 @@ if(WIN32) find_path( GLUT_INCLUDE_DIR NAMES GL/glut.h PATHS ${GLUT_ROOT_PATH}/include ) mark_as_advanced(GLUT_INCLUDE_DIR) - find_library( GLUT_glut_LIBRARY_RELEASE NAMES glut glut32 freeglut + find_library( GLUT_glut_LIBRARY_RELEASE NAMES freeglut glut glut32 PATHS ${OPENGL_LIBRARY_DIR} ${GLUT_ROOT_PATH}/Release diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 25c5c09..2233aa0 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -53,7 +53,7 @@ is set regardless of the presence of the ``Server`` component in find_package ca # In Windows the default installation of PostgreSQL uses that as part of the path. # E.g C:\Program Files\PostgreSQL\8.4. # Currently, the following version numbers are known to this module: -# "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" +# "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" # # To use this variable just do something like this: # set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") @@ -102,7 +102,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") + "14" "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") # Define additional search paths for root directories. set( PostgreSQL_ROOT_DIRECTORIES diff --git a/Modules/Internal/HeaderpadWorkaround.cmake b/Modules/Internal/HeaderpadWorkaround.cmake new file mode 100644 index 0000000..9a7f9f5 --- /dev/null +++ b/Modules/Internal/HeaderpadWorkaround.cmake @@ -0,0 +1,69 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# Do NOT include this module directly into any of your code. It is used by +# the try_compile() implementation to work around a specific issue with +# conflicting flags when building for Apple platforms. +if(NOT APPLE) + return() +endif() + +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + +function(__cmake_internal_workaround_headerpad_flag_conflict _LANG) + + # Until we can avoid hard-coding -Wl,-headerpad_max_install_names in the + # linker flags, we need to remove it here for cases where we know it will + # conflict with other flags, generate a warning and be ignored. + set(regex "(^| )(-fembed-bitcode(-marker|=(all|bitcode|marker))?|-bundle_bitcode)($| )") + set(remove_headerpad NO) + + # Check arbitrary flags that the user or project has set. These compiler + # flags get added to the linker command line. + if("${CMAKE_${_LANG}_FLAGS}" MATCHES "${regex}") + set(remove_headerpad YES) + endif() + if(NOT remove_headerpad) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + # Only one of these config-specific variables will be set by try_compile() + # and the rest will be unset, but we can't easily tell which one is set. + # No harm to just add them all here, empty ones won't add flags to check. + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) + if("${CMAKE_${_LANG}_FLAGS_${config}}" MATCHES "${regex}") + set(remove_headerpad YES) + break() + endif() + endforeach() + else() + if("${CMAKE_${_LANG}_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}") + set(remove_headerpad YES) + endif() + endif() + endif() + + # The try_compile() command passes compiler flags to check in a way that + # results in them being added to add_definitions(). Those don't end up on + # the linker command line, so we don't need to check them here. + + if(remove_headerpad) + foreach(flag IN ITEMS + CMAKE_${_LANG}_LINK_FLAGS + CMAKE_SHARED_LIBRARY_CREATE_${_LANG}_FLAGS + CMAKE_SHARED_MODULE_CREATE_${_LANG}_FLAGS) + string(REPLACE "-Wl,-headerpad_max_install_names" "" ${flag} "${${flag}}") + set(${flag} "${${flag}}" PARENT_SCOPE) + endforeach() + endif() +endfunction() + +get_property(__enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(__lang IN LISTS __enabled_languages) + __cmake_internal_workaround_headerpad_flag_conflict(${__lang}) +endforeach() +unset(__lang) +unset(__enabled_languages) + +cmake_policy(POP) |