diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-19 14:00:29 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-10-19 14:00:29 (GMT) |
commit | 31b6825bd2bfea564315ccf6f275023e15e9af06 (patch) | |
tree | ed0d1628857f295268bbdf07012e8711996efb12 /Modules | |
parent | 15bbff05818607a8287ab5d4584428ec331005ee (diff) | |
parent | 1771ec85b6475c10566026ad7813eb74f732d507 (diff) | |
download | CMake-31b6825bd2bfea564315ccf6f275023e15e9af06.zip CMake-31b6825bd2bfea564315ccf6f275023e15e9af06.tar.gz CMake-31b6825bd2bfea564315ccf6f275023e15e9af06.tar.bz2 |
Merge branch 'master' into deployqt4-cmp0080-fix
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/BundleUtilities.cmake | 7 | ||||
-rw-r--r-- | Modules/FindLibinput.cmake | 83 | ||||
-rw-r--r-- | Modules/FindOpenGL.cmake | 245 | ||||
-rw-r--r-- | Modules/FindQt.cmake | 10 | ||||
-rw-r--r-- | Modules/FindwxWidgets.cmake | 46 | ||||
-rw-r--r-- | Modules/UseSWIG.cmake | 7 | ||||
-rw-r--r-- | Modules/Use_wxWindows.cmake | 3 |
7 files changed, 253 insertions, 148 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 613ba1a..6940352 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -225,11 +225,8 @@ external file causes this function to fail the verification. #]=======================================================================] function(_warn_cmp0080) - message(AUTHOR_WARNING - "Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. " - "Run \"cmake --help-policy CMP0080\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - ) + cmake_policy(GET_WARNING CMP0080 _cmp0080_warning) + message(AUTHOR_WARNING "${_cmp0080_warning}\n") endfunction() # Do not include this module at configure time! diff --git a/Modules/FindLibinput.cmake b/Modules/FindLibinput.cmake new file mode 100644 index 0000000..1057c91 --- /dev/null +++ b/Modules/FindLibinput.cmake @@ -0,0 +1,83 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibinput +------------ + +Find libinput headers and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +``Libinput::Libinput`` + The libinput library, if found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables in your project: + +``Libinput_FOUND`` + true if (the requested version of) libinput is available. +``Libinput_VERSION`` + the version of libinput. +``Libinput_LIBRARIES`` + the libraries to link against to use libinput. +``Libinput_INCLUDE_DIRS`` + where to find the libinput headers. +``Libinput_COMPILE_OPTIONS`` + this should be passed to target_compile_options(), if the + target is not used for linking + +#]=======================================================================] + + +# Use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig QUIET) +pkg_check_modules(PKG_Libinput QUIET libinput) + +set(Libinput_COMPILE_OPTIONS ${PKG_Libinput_CFLAGS_OTHER}) +set(Libinput_VERSION ${PKG_Libinput_VERSION}) + +find_path(Libinput_INCLUDE_DIR + NAMES + libinput.h + HINTS + ${PKG_Libinput_INCLUDE_DIRS} +) +find_library(Libinput_LIBRARY + NAMES + input + HINTS + ${PKG_Libinput_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libinput + FOUND_VAR + Libinput_FOUND + REQUIRED_VARS + Libinput_LIBRARY + Libinput_INCLUDE_DIR + VERSION_VAR + Libinput_VERSION +) + +if(Libinput_FOUND AND NOT TARGET Libinput::Libinput) + add_library(Libinput::Libinput UNKNOWN IMPORTED) + set_target_properties(Libinput::Libinput PROPERTIES + IMPORTED_LOCATION "${Libinput_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Libinput_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Libinput_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced(Libinput_LIBRARY Libinput_INCLUDE_DIR) + +if(Libinput_FOUND) + set(Libinput_LIBRARIES ${Libinput_LIBRARY}) + set(Libinput_INCLUDE_DIRS ${Libinput_INCLUDE_DIR}) + set(Libinput_VERSION_STRING ${Libinput_VERSION}) +endif() diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 4d0786c..832dca2 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -1,125 +1,126 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -#.rst: -# FindOpenGL -# ---------- -# -# FindModule for OpenGL and GLU. -# -# Optional COMPONENTS -# ^^^^^^^^^^^^^^^^^^^ -# -# This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and -# ``OpenGL``. There are corresponding import targets for each of these flags. -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the :prop_tgt:`IMPORTED` targets: -# -# ``OpenGL::GL`` -# Defined to the platform-specific OpenGL libraries if the system has OpenGL. -# ``OpenGL::OpenGL`` -# Defined to libOpenGL if the system is GLVND-based. -# ``OpenGL::GLU`` -# Defined if the system has GLU. -# ``OpenGL::GLX`` -# Defined if the system has GLX. -# ``OpenGL::EGL`` -# Defined if the system has EGL. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module sets the following variables: -# -# ``OPENGL_FOUND`` -# True, if the system has OpenGL and all components are found. -# ``OPENGL_XMESA_FOUND`` -# True, if the system has XMESA. -# ``OPENGL_GLU_FOUND`` -# True, if the system has GLU. -# ``OpenGL_OpenGL_FOUND`` -# True, if the system has an OpenGL library. -# ``OpenGL_GLX_FOUND`` -# True, if the system has GLX. -# ``OpenGL_EGL_FOUND`` -# True, if the system has EGL. -# ``OPENGL_INCLUDE_DIR`` -# Path to the OpenGL include directory. -# ``OPENGL_EGL_INCLUDE_DIRS`` -# Path to the EGL include directory. -# ``OPENGL_LIBRARIES`` -# Paths to the OpenGL library, windowing system libraries, and GLU libraries. -# On Linux, this assumes GLX and is never correct for EGL-based targets. -# Clients are encouraged to use the ``OpenGL::*`` import targets instead. -# -# Cache variables -# ^^^^^^^^^^^^^^^ -# -# The following cache variables may also be set: -# -# ``OPENGL_egl_LIBRARY`` -# Path to the EGL library. -# ``OPENGL_glu_LIBRARY`` -# Path to the GLU library. -# ``OPENGL_glx_LIBRARY`` -# Path to the GLVND 'GLX' library. -# ``OPENGL_opengl_LIBRARY`` -# Path to the GLVND 'OpenGL' library -# ``OPENGL_gl_LIBRARY`` -# Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import -# targets. -# -# Linux-specific -# ^^^^^^^^^^^^^^ -# -# Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates -# context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and -# contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way -# to get OpenGL 3+ functionality via EGL in a manner portable across vendors. -# Projects may use GLVND explicitly with target ``OpenGL::OpenGL`` and either -# ``OpenGL::GLX`` or ``OpenGL::EGL``. -# -# Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable) -# to use legacy GL interfaces. These will use the legacy GL library located -# by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or -# not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND -# ``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES`` -# variable will use the corresponding libraries). Thus, for non-EGL-based -# Linux targets, the ``OpenGL::GL`` target is most portable. -# -# A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way -# to provide legacy GL interfaces in case multiple choices are available. -# The value may be one of: -# -# ``GLVND`` -# If the GLVND OpenGL and GLX libraries are available, prefer them. -# This forces ``OPENGL_gl_LIBRARY`` to be empty. -# This is the default if components were requested (since components -# correspond to GLVND libraries) or if policy :policy:`CMP0072` is -# set to ``NEW``. -# -# ``LEGACY`` -# Prefer to use the legacy libGL library, if available. -# This is the default if no components were requested and -# policy :policy:`CMP0072` is not set to ``NEW``. -# -# For EGL targets the client must rely on GLVND support on the user's system. -# Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES* -# libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this -# module does not currently support that; contributions welcome. -# -# ``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of -# GLVND. For non-GLVND Linux and other systems these are left undefined. -# -# macOS-Specific -# ^^^^^^^^^^^^^^ -# -# On OSX FindOpenGL defaults to using the framework version of OpenGL. People -# will have to change the cache values of OPENGL_glu_LIBRARY and -# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX. +#[=======================================================================[.rst: +FindOpenGL +---------- + +FindModule for OpenGL and GLU. + +Optional COMPONENTS +^^^^^^^^^^^^^^^^^^^ + +This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and +``OpenGL``. There are corresponding import targets for each of these flags. + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines the :prop_tgt:`IMPORTED` targets: + +``OpenGL::GL`` + Defined to the platform-specific OpenGL libraries if the system has OpenGL. +``OpenGL::OpenGL`` + Defined to libOpenGL if the system is GLVND-based. +``OpenGL::GLU`` + Defined if the system has GLU. +``OpenGL::GLX`` + Defined if the system has GLX. +``OpenGL::EGL`` + Defined if the system has EGL. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module sets the following variables: + +``OPENGL_FOUND`` + True, if the system has OpenGL and all components are found. +``OPENGL_XMESA_FOUND`` + True, if the system has XMESA. +``OPENGL_GLU_FOUND`` + True, if the system has GLU. +``OpenGL_OpenGL_FOUND`` + True, if the system has an OpenGL library. +``OpenGL_GLX_FOUND`` + True, if the system has GLX. +``OpenGL_EGL_FOUND`` + True, if the system has EGL. +``OPENGL_INCLUDE_DIR`` + Path to the OpenGL include directory. +``OPENGL_EGL_INCLUDE_DIRS`` + Path to the EGL include directory. +``OPENGL_LIBRARIES`` + Paths to the OpenGL library, windowing system libraries, and GLU libraries. + On Linux, this assumes GLX and is never correct for EGL-based targets. + Clients are encouraged to use the ``OpenGL::*`` import targets instead. + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``OPENGL_egl_LIBRARY`` + Path to the EGL library. +``OPENGL_glu_LIBRARY`` + Path to the GLU library. +``OPENGL_glx_LIBRARY`` + Path to the GLVND 'GLX' library. +``OPENGL_opengl_LIBRARY`` + Path to the GLVND 'OpenGL' library +``OPENGL_gl_LIBRARY`` + Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import + targets. + +Linux-specific +^^^^^^^^^^^^^^ + +Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates +context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and +contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way +to get OpenGL 3+ functionality via EGL in a manner portable across vendors. +Projects may use GLVND explicitly with target ``OpenGL::OpenGL`` and either +``OpenGL::GLX`` or ``OpenGL::EGL``. + +Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable) +to use legacy GL interfaces. These will use the legacy GL library located +by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or +not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND +``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES`` +variable will use the corresponding libraries). Thus, for non-EGL-based +Linux targets, the ``OpenGL::GL`` target is most portable. + +A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way +to provide legacy GL interfaces in case multiple choices are available. +The value may be one of: + +``GLVND`` + If the GLVND OpenGL and GLX libraries are available, prefer them. + This forces ``OPENGL_gl_LIBRARY`` to be empty. + This is the default if components were requested (since components + correspond to GLVND libraries) or if policy :policy:`CMP0072` is + set to ``NEW``. + +``LEGACY`` + Prefer to use the legacy libGL library, if available. + This is the default if no components were requested and + policy :policy:`CMP0072` is not set to ``NEW``. + +For EGL targets the client must rely on GLVND support on the user's system. +Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES* +libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this +module does not currently support that; contributions welcome. + +``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of +GLVND. For non-GLVND Linux and other systems these are left undefined. + +macOS-Specific +^^^^^^^^^^^^^^ + +On OSX FindOpenGL defaults to using the framework version of OpenGL. People +will have to change the cache values of OPENGL_glu_LIBRARY and +OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX. +#]=======================================================================] set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY) @@ -267,11 +268,9 @@ else() endif() if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) + cmake_policy(GET_WARNING CMP0072 _cmp0072_warning) message(AUTHOR_WARNING - "Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. " - "Run \"cmake --help-policy CMP0072\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - "\n" + "${_cmp0072_warning}\n" "FindOpenGL found both a legacy GL library:\n" " OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}\n" "and GLVND libraries for OpenGL and GLX:\n" diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 68dfa7d..4dff7c3 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -5,9 +5,12 @@ # FindQt # ------ # -# Searches for all installed versions of Qt. +# Searches for all installed versions of Qt3 or Qt4. # -# This should only be used if your project can work with multiple +# This module cannot handle Qt5 or any later versions. +# For those, see :manual:`cmake-qt(7)`. +# +# This module should only be used if your project can work with multiple # versions of Qt. If not, you should just directly use FindQt4 or # FindQt3. If multiple versions of Qt are found on the machine, then # The user must set the option DESIRED_QT_VERSION to the version they @@ -16,9 +19,6 @@ # or FindQt4 module is included. Once the user sets DESIRED_QT_VERSION, # then the FindQt3 or FindQt4 module is included. # -# This module can only detect and switch between Qt versions 3 and 4. It -# cannot handle Qt5 or any later versions. -# # :: # # QT_REQUIRED if this is set to TRUE then if CMake can diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index f2d6285..e366842 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -12,7 +12,7 @@ # modules that you will use, you need to name them as components to the # package: # -# find_package(wxWidgets COMPONENTS core base ...) +# find_package(wxWidgets COMPONENTS core base ... OPTIONAL_COMPONENTS net ...) # # There are two search branches: a windows style and a unix style. For # windows, the following variables are searched for and set to defaults @@ -89,7 +89,7 @@ # :: # # # Note that for MinGW users the order of libs is important! -# find_package(wxWidgets COMPONENTS net gl core base) +# find_package(wxWidgets COMPONENTS gl core base OPTIONAL_COMPONENTS net) # if(wxWidgets_FOUND) # include(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: @@ -102,7 +102,7 @@ # # :: # -# find_package(wxWidgets REQUIRED net gl core base) +# find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net) # include(${wxWidgets_USE_FILE}) # # and for each of your dependent executable/library targets: # target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES}) @@ -396,6 +396,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") list(APPEND wxWidgets_LIBRARIES debug ${WX_${LIB}d} optimized ${WX_${LIB}} ) + set(wxWidgets_${LIB}_FOUND TRUE) + elseif(NOT wxWidgets_FIND_REQUIRED_${LIB}) + DBG_MSG_V("- ignored optional missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}") else() DBG_MSG_V("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}") set(wxWidgets_FOUND FALSE) @@ -408,9 +411,11 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") if(WX_${LIB}${_DBG}) DBG_MSG_V("Found ${LIB}${_DBG}") list(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}}) + set(wxWidgets_${LIB}_FOUND TRUE) + elseif(NOT wxWidgets_FIND_REQUIRED_${LIB}) + DBG_MSG_V("- ignored optional missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}") else() - DBG_MSG_V( - "- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}") + DBG_MSG_V("- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}") set(wxWidgets_FOUND FALSE) endif() endforeach() @@ -803,11 +808,24 @@ else() # - NOTE: wx-config doesn't verify that the libs requested exist # it just produces the names. Maybe a TRY_COMPILE would # be useful here... - string(REPLACE ";" "," - wxWidgets_FIND_COMPONENTS "${wxWidgets_FIND_COMPONENTS}") + unset(_cmp_req) + unset(_cmp_opt) + foreach(_cmp IN LISTS wxWidgets_FIND_COMPONENTS) + if(wxWidgets_FIND_REQUIRED_${_cmp}) + list(APPEND _cmp_req "${_cmp}") + else() + list(APPEND _cmp_opt "${_cmp}") + endif() + endforeach() + DBG_MSG_V("wxWidgets required components : ${_cmp_req}") + DBG_MSG_V("wxWidgets optional components : ${_cmp_opt}") + if(DEFINED _cmp_opt) + string(REPLACE ";" "," _cmp_opt "--optional-libs ${_cmp_opt}") + endif() + string(REPLACE ";" "," _cmp_req "${_cmp_req}") execute_process( COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" - ${wxWidgets_SELECT_OPTIONS} --libs ${wxWidgets_FIND_COMPONENTS} + ${wxWidgets_SELECT_OPTIONS} --libs ${_cmp_req} ${_cmp_opt} OUTPUT_VARIABLE wxWidgets_LIBRARIES RESULT_VARIABLE RET ERROR_QUIET @@ -833,8 +851,10 @@ else() else() set(wxWidgets_FOUND FALSE) - DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}") + DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${_cmp_req} ${_cmp_opt} FAILED with RET=${RET}") endif() + unset(_cmp_req) + unset(_cmp_opt) endif() # When using wx-config in MSYS, the include paths are UNIX style paths which may or may @@ -960,10 +980,18 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}") include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# FIXME: set wxWidgets_<comp>_FOUND for wx-config branch +# and use HANDLE_COMPONENTS on Unix too +if(wxWidgets_FIND_STYLE STREQUAL "win32") + set(wxWidgets_HANDLE_COMPONENTS "HANDLE_COMPONENTS") +endif() + find_package_handle_standard_args(wxWidgets REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS VERSION_VAR wxWidgets_VERSION_STRING + ${wxWidgets_HANDLE_COMPONENTS} ) +unset(wxWidgets_HANDLE_COMPONENTS) #===================================================================== # Macros for use in wxWidgets apps. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index f20a53b..edb8294 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -554,11 +554,8 @@ function(SWIG_ADD_LIBRARY name) set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD) else() if (NOT target_name_policy) - message(AUTHOR_WARNING - "Policy CMP0078 is not set. " - "Run \"cmake --help-policy CMP0078\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - ) + cmake_policy(GET_WARNING CMP0078 _cmp0078_warning) + message(AUTHOR_WARNING "${_cmp0078_warning}\n") endif() if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE) set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY) diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake index bd8cc01..7cdd92e 100644 --- a/Modules/Use_wxWindows.cmake +++ b/Modules/Use_wxWindows.cmake @@ -5,7 +5,8 @@ # Use_wxWindows # ------------- # -# +# Deprecated. Use ``find_package(wxWidgets)`` and +# ``include(${wxWidgets_USE_FILE})`` instead. # # # This convenience include finds if wxWindows is installed and set the |