1 From 6cb639c7f5e68b3e494db555fa99920dc1788c59 Mon Sep 17 00:00:00 2001
2 From: Aurelien Larcher <aurelien.larcher@gmail.com>
3 Date: Sun, 15 Mar 2020 22:46:58 +0100
4 Subject: [PATCH] Re-add CMake install and uninstall scripts
7 CMakeLists.txt | 77 ++++++++-
8 cmake/CMakePackageConfigHelpers.cmake | 227 ++++++++++++++++++++++++++
9 cmake/GNUInstallDirs.cmake | 188 +++++++++++++++++++++
11 cmake/glmBuildConfig.cmake.in | 6 +
12 cmake/glmConfig.cmake.in | 9 +
13 cmake_uninstall.cmake.in | 26 +++
14 glm/CMakeLists.txt | 5 +-
16 9 files changed, 542 insertions(+), 6 deletions(-)
17 create mode 100644 cmake/CMakePackageConfigHelpers.cmake
18 create mode 100644 cmake/GNUInstallDirs.cmake
19 create mode 100644 cmake/glm.pc.in
20 create mode 100644 cmake/glmBuildConfig.cmake.in
21 create mode 100644 cmake/glmConfig.cmake.in
22 create mode 100644 cmake_uninstall.cmake.in
24 diff --git a/CMakeLists.txt b/CMakeLists.txt
25 index 843e7546..80e5f1f8 100644
28 @@ -3,13 +3,88 @@ cmake_policy(VERSION 3.2)
30 set(GLM_VERSION "0.9.9")
31 project(glm VERSION ${GLM_VERSION} LANGUAGES CXX)
33 +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
35 +include(GNUInstallDirs)
36 +include(CMakePackageConfigHelpers)
41 -add_library(glm::glm ALIAS glm)
43 +macro(install_headers dir patterns)
46 + foreach(pattern ${patterns})
47 + file(GLOB FILES ${DIR}/${pattern})
48 + foreach(FILE ${FILES})
49 + install(FILES ${FILE} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${DIR})
56 +install_headers("glm;glm/detail;glm/ext;glm/gtc;glm/gtx;glm/simd" "*.h;*.hpp;*.inl")
58 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
60 add_subdirectory(test)
62 endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
64 +set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
66 +# CMake automatically adds an architecture compatibility check to make sure
67 +# 32 and 64 bit code is not accidentally mixed. For a header-only library this
68 +# is not required. The check can be disabled by temporarily unsetting
69 +# CMAKE_SIZEOF_VOID_P. In CMake 3.14 and later this can be achieved more cleanly
70 +# with write_basic_package_version_file(ARCH_INDEPENDENT).
71 +# TODO: Use this once a newer CMake can be required.
72 +set(GLM_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
73 +unset(CMAKE_SIZEOF_VOID_P)
74 +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" VERSION ${GLM_VERSION} COMPATIBILITY AnyNewerVersion)
75 +set(CMAKE_SIZEOF_VOID_P ${GLM_SIZEOF_VOID_P})
77 +# build tree package config
78 +configure_file(cmake/glmBuildConfig.cmake.in glmConfig.cmake @ONLY)
80 +# install tree package config
81 +configure_package_config_file(
82 + cmake/glmConfig.cmake.in
83 + ${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake
84 + INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR}
85 + PATH_VARS CMAKE_INSTALL_INCLUDEDIR
86 + NO_CHECK_REQUIRED_COMPONENTS_MACRO)
89 + "${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
90 + "${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake"
91 + DESTINATION ${GLM_INSTALL_CONFIGDIR})
93 +add_library(glm::glm ALIAS glm)
94 +install(TARGETS glm EXPORT glmTargets)
96 +export(EXPORT glmTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake")
98 +install(EXPORT glmTargets FILE glmTargets.cmake DESTINATION ${GLM_INSTALL_CONFIGDIR})
100 +# build pkg-config file
101 +configure_file("./cmake/glm.pc.in" "glm.pc" @ONLY)
103 +# install pkg-config file
104 +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glm.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
108 +if(NOT TARGET uninstall)
110 + ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in
111 + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
114 + add_custom_target(uninstall
115 + COMMAND ${CMAKE_COMMAND} -P
116 + ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
118 diff --git a/cmake/CMakePackageConfigHelpers.cmake b/cmake/CMakePackageConfigHelpers.cmake
120 index 00000000..d5bf4a2f
122 +++ b/cmake/CMakePackageConfigHelpers.cmake
124 +# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
126 +# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
127 +# [PATH_VARS <var1> <var2> ... <varN>]
128 +# [NO_SET_AND_CHECK_MACRO]
129 +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
131 +# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
132 +# CONFIGURE_FILE() command when creating the <Name>Config.cmake or <Name>-config.cmake
133 +# file for installing a project or library. It helps making the resulting package
134 +# relocatable by avoiding hardcoded paths in the installed Config.cmake file.
136 +# In a FooConfig.cmake file there may be code like this to make the
137 +# install destinations know to the using project:
138 +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
139 +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
140 +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
141 +# ...logic to determine installedPrefix from the own location...
142 +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
143 +# All 4 options shown above are not sufficient, since the first 3 hardcode
144 +# the absolute directory locations, and the 4th case works only if the logic
145 +# to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains
146 +# a relative path, which in general cannot be guaranteed.
147 +# This has the effect that the resulting FooConfig.cmake file would work poorly
148 +# under Windows and OSX, where users are used to choose the install location
149 +# of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX
150 +# was set at build/cmake time.
152 +# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the
153 +# resulting FooConfig.cmake file relocatable.
155 +# 1. write a FooConfig.cmake.in file as you are used to
156 +# 2. insert a line containing only the string "@PACKAGE_INIT@"
157 +# 3. instead of SET(FOO_DIR "@SOME_INSTALL_DIR@"), use SET(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")
158 +# (this must be after the @PACKAGE_INIT@ line)
159 +# 4. instead of using the normal CONFIGURE_FILE(), use CONFIGURE_PACKAGE_CONFIG_FILE()
161 +# The <input> and <output> arguments are the input and output file, the same way
162 +# as in CONFIGURE_FILE().
164 +# The <path> given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake
165 +# file will be installed to. This can either be a relative or absolute path, both work.
167 +# The variables <var1> to <varN> given as PATH_VARS are the variables which contain
168 +# install destinations. For each of them the macro will create a helper variable
169 +# PACKAGE_<var...>. These helper variables must be used
170 +# in the FooConfig.cmake.in file for setting the installed location. They are calculated
171 +# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the
172 +# installed location of the package. This works both for relative and also for absolute locations.
173 +# For absolute locations it works only if the absolute location is a subdirectory
174 +# of CMAKE_INSTALL_PREFIX.
176 +# By default configure_package_config_file() also generates two helper macros,
177 +# set_and_check() and check_required_components() into the FooConfig.cmake file.
179 +# set_and_check() should be used instead of the normal set()
180 +# command for setting directories and file locations. Additionally to setting the
181 +# variable it also checks that the referenced file or directory actually exists
182 +# and fails with a FATAL_ERROR otherwise. This makes sure that the created
183 +# FooConfig.cmake file does not contain wrong references.
184 +# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the
185 +# FooConfig.cmake file.
187 +# check_required_components(<package_name>) should be called at the end of the
188 +# FooConfig.cmake file if the package supports components.
189 +# This macro checks whether all requested, non-optional components have been found,
190 +# and if this is not the case, sets the Foo_FOUND variable to FALSE, so that the package
191 +# is considered to be not found.
192 +# It does that by testing the Foo_<Component>_FOUND variables for all requested
193 +# required components.
194 +# When using the NO_CHECK_REQUIRED_COMPONENTS option, this macro is not generated
195 +# into the FooConfig.cmake file.
197 +# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE().
200 +# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
202 +# Writes a file for use as <package>ConfigVersion.cmake file to <filename>.
203 +# See the documentation of FIND_PACKAGE() for details on this.
204 +# filename is the output filename, it should be in the build tree.
205 +# major.minor.patch is the version number of the project to be installed
206 +# The COMPATIBILITY mode AnyNewerVersion means that the installed package version
207 +# will be considered compatible if it is newer or exactly the same as the requested version.
208 +# This mode should be used for packages which are fully backward compatible,
209 +# also across major versions.
210 +# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion
211 +# in that the major version number must be the same as requested, e.g. version 2.0 will
212 +# not be considered compatible if 1.0 is requested.
213 +# This mode should be used for packages which guarantee backward compatibility within the
214 +# same major version.
215 +# If ExactVersion is used, then the package is only considered compatible if the requested
216 +# version matches exactly its own version number (not considering the tweak version).
217 +# For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3.
218 +# This mode is for packages without compatibility guarantees.
219 +# If your project has more elaborated version matching rules, you will need to write your
220 +# own custom ConfigVersion.cmake file instead of using this macro.
222 +# Internally, this macro executes configure_file() to create the resulting
223 +# version file. Depending on the COMPATIBILITY, either the file
224 +# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in
225 +# is used. Please note that these two files are internal to CMake and you should
226 +# not call configure_file() on them yourself, but they can be used as starting
227 +# point to create more sophisticted custom ConfigVersion.cmake files.
230 +# Example using both configure_package_config_file() and write_basic_package_version_file():
232 +# set(INCLUDE_INSTALL_DIR include/ ... CACHE )
233 +# set(LIB_INSTALL_DIR lib/ ... CACHE )
234 +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
236 +# include(CMakePackageConfigHelpers)
237 +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
238 +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
239 +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
240 +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
242 +# COMPATIBILITY SameMajorVersion )
243 +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
244 +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
246 +# With a FooConfig.cmake.in:
247 +# set(FOO_VERSION x.y.z)
251 +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
252 +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
254 +# check_required_components(Foo)
257 +#=============================================================================
258 +# Copyright 2012 Alexander Neundorf <neundorf@kde.org>
260 +# Distributed under the OSI-approved BSD License (the "License");
261 +# see accompanying file Copyright.txt for details.
263 +# This software is distributed WITHOUT ANY WARRANTY; without even the
264 +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
265 +# See the License for more information.
266 +#=============================================================================
267 +# (To distribute this file outside of CMake, substitute the full
268 +# License text for the above reference.)
270 +include(CMakeParseArguments)
272 +include(WriteBasicConfigVersionFile)
274 +macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
275 + write_basic_config_version_file(${ARGN})
279 +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
280 + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
281 + set(oneValueArgs INSTALL_DESTINATION )
282 + set(multiValueArgs PATH_VARS )
284 + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
286 + if(CCF_UNPARSED_ARGUMENTS)
287 + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
290 + if(NOT CCF_INSTALL_DESTINATION)
291 + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
294 + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
295 + set(absInstallDir "${CCF_INSTALL_DESTINATION}")
297 + set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
299 + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
301 + foreach(var ${CCF_PATH_VARS})
302 + if(NOT DEFINED ${var})
303 + message(FATAL_ERROR "Variable ${var} does not exist")
305 + if(IS_ABSOLUTE "${${var}}")
306 + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
307 + PACKAGE_${var} "${${var}}")
309 + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
315 +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
316 +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
319 + if(NOT CCF_NO_SET_AND_CHECK_MACRO)
320 + set(PACKAGE_INIT "${PACKAGE_INIT}
321 +macro(set_and_check _var _file)
322 + set(\${_var} \"\${_file}\")
323 + if(NOT EXISTS \"\${_file}\")
324 + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
331 + if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
332 + set(PACKAGE_INIT "${PACKAGE_INIT}
333 +macro(check_required_components _NAME)
334 + foreach(comp \${\${_NAME}_FIND_COMPONENTS})
335 + if(NOT \${_NAME}_\${comp}_FOUND)
336 + if(\${_NAME}_FIND_REQUIRED_\${comp})
337 + set(\${_NAME}_FOUND FALSE)
345 + set(PACKAGE_INIT "${PACKAGE_INIT}
346 +####################################################################################")
348 + configure_file("${_inputFile}" "${_outputFile}" @ONLY)
351 diff --git a/cmake/GNUInstallDirs.cmake b/cmake/GNUInstallDirs.cmake
353 index 00000000..4dc2d68a
355 +++ b/cmake/GNUInstallDirs.cmake
357 +# - Define GNU standard installation directories
358 +# Provides install directory variables as defined for GNU software:
359 +# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
360 +# Inclusion of this module defines the following variables:
361 +# CMAKE_INSTALL_<dir> - destination for files of a given type
362 +# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
363 +# where <dir> is one of:
364 +# BINDIR - user executables (bin)
365 +# SBINDIR - system admin executables (sbin)
366 +# LIBEXECDIR - program executables (libexec)
367 +# SYSCONFDIR - read-only single-machine data (etc)
368 +# SHAREDSTATEDIR - modifiable architecture-independent data (com)
369 +# LOCALSTATEDIR - modifiable single-machine data (var)
370 +# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
371 +# INCLUDEDIR - C header files (include)
372 +# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
373 +# DATAROOTDIR - read-only architecture-independent data root (share)
374 +# DATADIR - read-only architecture-independent data (DATAROOTDIR)
375 +# INFODIR - info documentation (DATAROOTDIR/info)
376 +# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
377 +# MANDIR - man documentation (DATAROOTDIR/man)
378 +# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
379 +# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
380 +# install() commands for the corresponding file type. If the includer does
381 +# not define a value the above-shown default will be used and the value will
382 +# appear in the cache for editing by the user.
383 +# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
384 +# from the corresponding destination by prepending (if necessary) the value
385 +# of CMAKE_INSTALL_PREFIX.
387 +#=============================================================================
388 +# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
389 +# Copyright 2011 Kitware, Inc.
391 +# Distributed under the OSI-approved BSD License (the "License");
392 +# see accompanying file Copyright.txt for details.
394 +# This software is distributed WITHOUT ANY WARRANTY; without even the
395 +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
396 +# See the License for more information.
397 +#=============================================================================
398 +# (To distribute this file outside of CMake, substitute the full
399 +# License text for the above reference.)
401 +# Installation directories
403 +if(NOT DEFINED CMAKE_INSTALL_BINDIR)
404 + set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
407 +if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
408 + set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
411 +if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
412 + set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
415 +if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
416 + set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
419 +if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
420 + set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
423 +if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
424 + set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
427 +if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
428 + set(_LIBDIR_DEFAULT "lib")
429 + # Override this default 'lib' with 'lib64' iff:
430 + # - we are on Linux system but NOT cross-compiling
431 + # - we are NOT on debian
432 + # - we are on a 64 bits system
433 + # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
434 + # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
435 + # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
436 + # See http://wiki.debian.org/Multiarch
437 + if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
438 + AND NOT CMAKE_CROSSCOMPILING)
439 + if (EXISTS "/etc/debian_version") # is this a debian system ?
440 + if(CMAKE_LIBRARY_ARCHITECTURE)
441 + set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
443 + else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
444 + if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
445 + message(AUTHOR_WARNING
446 + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
447 + "Please enable at least one language before including GNUInstallDirs.")
449 + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
450 + set(_LIBDIR_DEFAULT "lib64")
455 + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
458 +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
459 + set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
462 +if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
463 + set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
466 +if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
467 + set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
470 +#-----------------------------------------------------------------------------
471 +# Values whose defaults are relative to DATAROOTDIR. Store empty values in
472 +# the cache and store the defaults in local variables if the cache values are
473 +# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
475 +if(NOT CMAKE_INSTALL_DATADIR)
476 + set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
477 + set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
480 +if(NOT CMAKE_INSTALL_INFODIR)
481 + set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
482 + set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
485 +if(NOT CMAKE_INSTALL_LOCALEDIR)
486 + set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
487 + set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
490 +if(NOT CMAKE_INSTALL_MANDIR)
491 + set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
492 + set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
495 +if(NOT CMAKE_INSTALL_DOCDIR)
496 + set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
497 + set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
500 +#-----------------------------------------------------------------------------
503 + CMAKE_INSTALL_BINDIR
504 + CMAKE_INSTALL_SBINDIR
505 + CMAKE_INSTALL_LIBEXECDIR
506 + CMAKE_INSTALL_SYSCONFDIR
507 + CMAKE_INSTALL_SHAREDSTATEDIR
508 + CMAKE_INSTALL_LOCALSTATEDIR
509 + CMAKE_INSTALL_LIBDIR
510 + CMAKE_INSTALL_INCLUDEDIR
511 + CMAKE_INSTALL_OLDINCLUDEDIR
512 + CMAKE_INSTALL_DATAROOTDIR
513 + CMAKE_INSTALL_DATADIR
514 + CMAKE_INSTALL_INFODIR
515 + CMAKE_INSTALL_LOCALEDIR
516 + CMAKE_INSTALL_MANDIR
517 + CMAKE_INSTALL_DOCDIR
520 +# Result directories
539 + if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
540 + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
542 + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
545 diff --git a/cmake/glm.pc.in b/cmake/glm.pc.in
547 index 00000000..fc5c7bb7
549 +++ b/cmake/glm.pc.in
551 +prefix=@CMAKE_INSTALL_PREFIX@
552 +includedir=${prefix}/include
555 +Description: OpenGL Mathematics
556 +Version: @GLM_VERSION@
557 +Cflags: -I${includedir}
558 diff --git a/cmake/glmBuildConfig.cmake.in b/cmake/glmBuildConfig.cmake.in
560 index 00000000..1258dea1
562 +++ b/cmake/glmBuildConfig.cmake.in
564 +set(GLM_VERSION "@GLM_VERSION@")
565 +set(GLM_INCLUDE_DIRS "@CMAKE_CURRENT_SOURCE_DIR@")
567 +if (NOT CMAKE_VERSION VERSION_LESS "3.0")
568 + include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")
570 diff --git a/cmake/glmConfig.cmake.in b/cmake/glmConfig.cmake.in
572 index 00000000..37d5ad81
574 +++ b/cmake/glmConfig.cmake.in
576 +set(GLM_VERSION "@GLM_VERSION@")
580 +set_and_check(GLM_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
582 +if (NOT CMAKE_VERSION VERSION_LESS "3.0")
583 + include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")
585 diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
587 index 00000000..d00a5166
589 +++ b/cmake_uninstall.cmake.in
591 +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
592 + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
593 +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
595 +if (NOT DEFINED CMAKE_INSTALL_PREFIX)
596 + set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
598 + message(${CMAKE_INSTALL_PREFIX})
600 +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
601 +string(REGEX REPLACE "\n" ";" files "${files}")
602 +foreach(file ${files})
603 + message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
604 + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
606 + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
607 + OUTPUT_VARIABLE rm_out
608 + RETURN_VALUE rm_retval
610 + if(NOT "${rm_retval}" STREQUAL 0)
611 + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
612 + endif(NOT "${rm_retval}" STREQUAL 0)
613 + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
614 + message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
615 + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
617 diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt
618 index 4ff51c81..996ec230 100644
619 --- a/glm/CMakeLists.txt
620 +++ b/glm/CMakeLists.txt
621 @@ -43,8 +43,9 @@ source_group("SIMD Files" FILES ${SIMD_INLINE})
622 source_group("SIMD Files" FILES ${SIMD_HEADER})
624 add_library(glm INTERFACE)
625 -target_include_directories(glm INTERFACE ../)
627 +target_include_directories(glm INTERFACE
628 + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
629 + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
630 if(BUILD_STATIC_LIBS)
631 add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
632 ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
633 diff --git a/readme.md b/readme.md
634 index 1c3db541..dad0ffbc 100644
637 @@ -97,9 +97,6 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
638 - Fixed Clang or GCC build due to wrong GLM_HAS_IF_CONSTEXPR definition #907
639 - Fixed CUDA 9 build #910
642 - - Removed CMake install and uninstall scripts
644 ### [GLM 0.9.9.5](https://github.com/g-truc/glm/releases/tag/0.9.9.5) - 2019-04-01
646 - Fixed build errors when defining GLM_ENABLE_EXPERIMENTAL #884 #883