aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-04-30 22:23:38 +0200
committerVictor Zverovich <victor.zverovich@gmail.com>2020-05-01 10:27:24 -0700
commit78f041ab5b40a1145ba686aeb8013e8788b08cd2 (patch)
treeba11ea3108777beedddf44e269244841da657906 /support
parent7ca89bf87a2dce05810471f1c7b1c0349ef9f432 (diff)
downloadfmtlib-78f041ab5b40a1145ba686aeb8013e8788b08cd2.tar.gz
build: Fix installation paths
It is not generally true that `CMAKE_INSTALL_<dir>` variables are relative paths: https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files
Diffstat (limited to 'support')
-rw-r--r--support/cmake/JoinPaths.cmake26
-rw-r--r--support/cmake/fmt.pc.in4
2 files changed, 28 insertions, 2 deletions
diff --git a/support/cmake/JoinPaths.cmake b/support/cmake/JoinPaths.cmake
new file mode 100644
index 00000000..32d6d668
--- /dev/null
+++ b/support/cmake/JoinPaths.cmake
@@ -0,0 +1,26 @@
+# This module provides function for joining paths
+# known from from most languages
+#
+# Original license:
+# SPDX-License-Identifier: (MIT OR CC0-1.0)
+# Explicit permission given to distribute this module under
+# the terms of the project as described in /LICENSE.rst.
+# Copyright 2020 Jan Tojnar
+# https://github.com/jtojnar/cmake-snips
+#
+# Modelled after Python’s os.path.join
+# https://docs.python.org/3.7/library/os.path.html#os.path.join
+# Windows not supported
+function(join_paths joined_path first_path_segment)
+ set(temp_path "${first_path_segment}")
+ foreach(current_segment IN LISTS ARGN)
+ if(NOT ("${current_segment}" STREQUAL ""))
+ if(IS_ABSOLUTE "${current_segment}")
+ set(temp_path "${current_segment}")
+ else()
+ set(temp_path "${temp_path}/${current_segment}")
+ endif()
+ endif()
+ endforeach()
+ set(${joined_path} "${temp_path}" PARENT_SCOPE)
+endfunction()
diff --git a/support/cmake/fmt.pc.in b/support/cmake/fmt.pc.in
index 4e030afd..29976a8a 100644
--- a/support/cmake/fmt.pc.in
+++ b/support/cmake/fmt.pc.in
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+libdir=@libdir_for_pc_file@
+includedir=@includedir_for_pc_file@
Name: fmt
Description: A modern formatting library