diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeRCCompiler.cmake.in | 2 | ||||
-rw-r--r-- | Modules/FindOpenGL.cmake | 76 | ||||
-rw-r--r-- | Modules/Platform/Android.cmake | 9 | ||||
-rw-r--r-- | Modules/WriteCompilerDetectionHeader.cmake | 62 |
4 files changed, 123 insertions, 26 deletions
diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in index 0fc3142..8257cd6 100644 --- a/Modules/CMakeRCCompiler.cmake.in +++ b/Modules/CMakeRCCompiler.cmake.in @@ -1,6 +1,6 @@ set(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@") set(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@") set(CMAKE_RC_COMPILER_LOADED 1) -set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc) +set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) set(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@) set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 21c2198..2b3bd14 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -2,32 +2,48 @@ # FindOpenGL # ---------- # -# Try to find OpenGL +# FindModule for OpenGL and GLU. # -# Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the :prop_tgt:`IMPORTED` targets: # -# OPENGL_FOUND - system has OpenGL -# OPENGL_XMESA_FOUND - system has XMESA -# OPENGL_GLU_FOUND - system has GLU -# OPENGL_INCLUDE_DIR - the GL include directory -# OPENGL_LIBRARIES - Link these to use OpenGL and GLU +# ``OpenGL::GL`` +# Defined if the system has OpenGL. +# ``OpenGL::GLU`` +# Defined if the system has GLU. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module sets the following variables: # -# If you want to use just GL you can use these values +# ``OPENGL_FOUND`` +# True, if the system has OpenGL. +# ``OPENGL_XMESA_FOUND`` +# True, if the system has XMESA. +# ``OPENGL_GLU_FOUND`` +# True, if the system has GLU. +# ``OPENGL_INCLUDE_DIR`` +# Path to the OpenGL include directory. +# ``OPENGL_LIBRARIES`` +# Paths to the OpenGL and GLU libraries. # -# :: +# If you want to use just GL you can use these values: # -# OPENGL_gl_LIBRARY - Path to OpenGL Library -# OPENGL_glu_LIBRARY - Path to GLU Library +# ``OPENGL_gl_LIBRARY`` +# Path to the OpenGL library. +# ``OPENGL_glu_LIBRARY`` +# Path to the GLU library. # +# OSX Specific +# ^^^^^^^^^^^^ # -# -# On OSX default to using the framework version of opengl People will +# On OSX default 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 +# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX. + #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -175,6 +191,36 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}) unset(_OpenGL_REQUIRED_VARS) +# OpenGL:: targets +if(OPENGL_FOUND) + if(NOT TARGET OpenGL::GL) + add_library(OpenGL::GL UNKNOWN IMPORTED) + set_target_properties(OpenGL::GL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}") + if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(OpenGL::GL PROPERTIES + IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(OpenGL::GL PROPERTIES + IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}") + endif() + endif() + + if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU) + add_library(OpenGL::GLU UNKNOWN IMPORTED) + set_target_properties(OpenGL::GLU PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES OpenGL::GL) + if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(OpenGL::GLU PROPERTIES + IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(OpenGL::GLU PROPERTIES + IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}") + endif() + endif() +endif() + mark_as_advanced( OPENGL_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake new file mode 100644 index 0000000..e6d4fcf --- /dev/null +++ b/Modules/Platform/Android.cmake @@ -0,0 +1,9 @@ +include(Platform/Linux) + +# Android has soname, but binary names must end in ".so" so we cannot append +# a version number. Also we cannot portably represent symlinks on the host. +set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) + +# Android reportedly ignores RPATH, and we cannot predict the install +# location anyway. +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 561a558..bf2dc37 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -141,16 +141,37 @@ # ``static_assert``, or ignored if using the backward compatibility # implementation. # -# ====================== ================================ =================== -# Feature Define Symbol -# ====================== ================================ =================== -# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas`` -# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof`` -# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` -# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert`` -# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert`` -# ====================== ================================ =================== - +# The ``cxx_attribute_deprecated`` feature provides a macro definition +# ``<PREFIX>_DEPRECATED``, which expands to either the standard +# ``[[deprecated]]`` attribute or a compiler-specific decorator such +# as ``__attribute__((__deprecated__))`` used by GNU compilers. +# +# ============================= ================================ ===================== +# Feature Define Symbol +# ============================= ================================ ===================== +# ``cxx_alignas`` ``<PREFIX>_ALIGNAS`` ``alignas`` +# ``cxx_alignof`` ``<PREFIX>_ALIGNOF`` ``alignof`` +# ``cxx_nullptr`` ``<PREFIX>_NULLPTR`` ``nullptr`` +# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT`` ``static_assert`` +# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert`` +# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]`` +# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]`` +# ============================= ================================ ===================== +# +# A use-case which arises with such deprecation macros is the deprecation +# of an entire library. In that case, all public API in the library may +# be decorated with the ``<PREFIX>_DEPRECATED`` macro. This results in +# very noisy build output when building the library itself, so the macro +# may be may be defined to empty in that case when building the deprecated +# library: +# +# .. code-block:: cmake +# +# add_library(compat_support ${srcs}) +# target_compile_definitions(compat_support +# PRIVATE +# CompatSupport_DEPRECATED= +# ) #============================================================================= # Copyright 2014 Stephen Kelly <steveire@gmail.com> @@ -456,6 +477,27 @@ function(write_compiler_detection_header # endif \n") endif() + if (feature STREQUAL cxx_attribute_deprecated) + set(def_name ${prefix_arg}_${feature_PP}) + set(def_value "${prefix_arg}_DEPRECATED") + set(file_content "${file_content} +# ifndef ${def_value} +# if ${def_name} +# define ${def_value} [[deprecated]] +# define ${def_value}_MSG(MSG) [[deprecated(MSG)]] +# elif defined(__GNUC__) || defined(__clang__) +# define ${def_value} __attribute__((__deprecated__)) +# define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG))) +# elif defined(_MSC_VER) +# define ${def_value} __declspec(deprecated) +# define ${def_value}_MSG(MSG) __declspec(deprecated(MSG)) +# else +# define ${def_value} +# define ${def_value}_MSG(MSG) +# endif +# endif +\n") + endif() endforeach() set(file_content "${file_content}#endif\n") |