mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-21 17:47:55 +08:00
99 lines
3.8 KiB
Diff
99 lines
3.8 KiB
Diff
|
From 0be627798d943558c674d4d92767ca255d847631 Mon Sep 17 00:00:00 2001
|
||
|
From: Manuel Massing <Manuel Massing m.massing@warped-space.de>
|
||
|
Date: Tue, 22 Nov 2016 12:26:39 +0100
|
||
|
Subject: [PATCH 3/3] CMake: configurable cmake config install location
|
||
|
|
||
|
---
|
||
|
CMakeLists.txt | 1 +
|
||
|
cmake/CMakeLists.txt | 14 +++++++-------
|
||
|
cmake/Proj4InstallPath.cmake | 12 +++++++++---
|
||
|
3 files changed, 17 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index cde21f0..1b1f892 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -106,6 +106,7 @@ set(LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries in
|
||
|
set(DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.")
|
||
|
set(DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.")
|
||
|
set(INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.")
|
||
|
+set(CMAKEDIR "${DEFAULT_CMAKE_CONFIGDIR}" CACHE PATH "The directory to install cmake files into.")
|
||
|
|
||
|
#################################################################################
|
||
|
# Build configured components
|
||
|
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||
|
index 742da0e..2bdef0d 100644
|
||
|
--- a/cmake/CMakeLists.txt
|
||
|
+++ b/cmake/CMakeLists.txt
|
||
|
@@ -2,13 +2,13 @@
|
||
|
# ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
|
||
|
# path to the root from there. (Note that the whole install tree can
|
||
|
# be relocated.)
|
||
|
-if (NOT WIN32)
|
||
|
- set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
|
||
|
- set (PROJECT_ROOT_DIR "../../..")
|
||
|
-else ()
|
||
|
- set (INSTALL_CMAKE_DIR "cmake")
|
||
|
- set (PROJECT_ROOT_DIR "..")
|
||
|
-endif ()
|
||
|
+
|
||
|
+set (INSTALL_CMAKE_DIR ${CMAKEDIR})
|
||
|
+if(NOT IS_ABSOLUTE ${INSTALL_CMAKE_DIR})
|
||
|
+ set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKEDIR}")
|
||
|
+endif()
|
||
|
+
|
||
|
+file(RELATIVE_PATH PROJECT_ROOT_DIR ${INSTALL_CMAKE_DIR} ${CMAKE_INSTALL_PREFIX})
|
||
|
|
||
|
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
|
||
|
configure_file (project-config.cmake.in project-config.cmake @ONLY)
|
||
|
diff --git a/cmake/Proj4InstallPath.cmake b/cmake/Proj4InstallPath.cmake
|
||
|
index da1491c..826fb29 100644
|
||
|
--- a/cmake/Proj4InstallPath.cmake
|
||
|
+++ b/cmake/Proj4InstallPath.cmake
|
||
|
@@ -28,13 +28,15 @@ if(WIN32)
|
||
|
set(DEFAULT_DATA_SUBDIR share)
|
||
|
set(DEFAULT_INCLUDE_SUBDIR local/include)
|
||
|
set(DEFAULT_DOC_SUBDIR share/doc/proj)
|
||
|
+ set(DEFAULT_CMAKE_CONFIG_SUBDIR "cmake")
|
||
|
else()
|
||
|
- # Common locatoins for Unix and Mac OS X
|
||
|
+ # Common locations for Unix and Mac OS X
|
||
|
set(DEFAULT_BIN_SUBDIR bin)
|
||
|
set(DEFAULT_LIB_SUBDIR lib)
|
||
|
set(DEFAULT_DATA_SUBDIR share/proj)
|
||
|
set(DEFAULT_DOC_SUBDIR doc/proj)
|
||
|
set(DEFAULT_INCLUDE_SUBDIR include)
|
||
|
+ set(DEFAULT_CMAKE_CONFIG_SUBDIR "share/cmake/${PROJECT_NAME}")
|
||
|
endif()
|
||
|
|
||
|
# Locations are changeable by user to customize layout of PDAL installation
|
||
|
@@ -49,19 +51,23 @@ set(PROJ_DATA_SUBDIR ${DEFAULT_DATA_SUBDIR} CACHE STRING
|
||
|
"Subdirectory where data will be installed")
|
||
|
set(PROJ_DOC_SUBDIR ${DEFAULT_DOC_SUBDIR} CACHE STRING
|
||
|
"Subdirectory where data will be installed")
|
||
|
-
|
||
|
+set(PROJ_CMAKE_CONFIG_SUBDIR ${DEFAULT_CMAKE_CONFIG_SUBDIR} CACHE STRING
|
||
|
+ "Subdirectory where cmake configuration files will be installed")
|
||
|
+
|
||
|
# Mark *DIR variables as advanced and dedicated to use by power-users only.
|
||
|
mark_as_advanced(PROJ_ROOT_DIR
|
||
|
PROJ_BIN_SUBDIR
|
||
|
PROJ_LIB_SUBDIR
|
||
|
PROJ_INCLUDE_SUBDIR
|
||
|
PROJ_DATA_SUBDIR
|
||
|
- PROJ_DOC_SUBDIR )
|
||
|
+ PROJ_DOC_SUBDIR
|
||
|
+ PROJ_CMAKE_CONFIG_SUBDIR)
|
||
|
|
||
|
set(DEFAULT_BINDIR "${PROJ_BIN_SUBDIR}")
|
||
|
set(DEFAULT_LIBDIR "${PROJ_LIB_SUBDIR}")
|
||
|
set(DEFAULT_DATADIR "${PROJ_DATA_SUBDIR}")
|
||
|
set(DEFAULT_DOCDIR "${PROJ_DOC_SUBDIR}")
|
||
|
set(DEFAULT_INCLUDEDIR "${PROJ_INCLUDE_SUBDIR}")
|
||
|
+set(DEFAULT_CMAKE_CONFIGDIR "${PROJ_CMAKE_CONFIG_SUBDIR}")
|
||
|
|
||
|
|
||
|
--
|
||
|
2.9.2.windows.1
|
||
|
|