blob: 9ff85b12a3cd6d8dcf3f9337fc94f860b4d09a73 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 2650bb3bd3644784359be373252b0436873ca8cb Mon Sep 17 00:00:00 2001
2From: Pascal Bach <pascal.bach@siemens.com>
3Date: Fri, 28 Sep 2018 16:44:37 +0200
4Subject: [PATCH] Make resulting cmake config relocatable
5
6This change avoids hardcoded install prefix in the p8-platform-config.cmake.
7Especially important when doing cross compilation with Yocto for example.
8
9Upstream-Status: Submitted [https://github.com/Pulse-Eight/platform/pull/38]
10
11---
12 CMakeLists.txt | 4 ----
13 p8-platform-config.cmake.in | 13 +++++++++----
14 2 files changed, 9 insertions(+), 8 deletions(-)
15
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index 7144b0b..f2db66e 100644
18--- a/CMakeLists.txt
19+++ b/CMakeLists.txt
20@@ -22,10 +22,6 @@ if(WIN32)
21 src/windows/os-threads.cpp)
22 endif()
23
24-set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform")
25-IF(WIN32)
26- LIST(APPEND p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform/windows")
27-ENDIF(WIN32)
28 set(p8-platform_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
29
30 if(NOT ${CORE_SYSTEM_NAME} STREQUAL "")
31diff --git a/p8-platform-config.cmake.in b/p8-platform-config.cmake.in
32index 47f30f1..b08e96c 100644
33--- a/p8-platform-config.cmake.in
34+++ b/p8-platform-config.cmake.in
35@@ -9,17 +9,22 @@
36 # p8-platform_LIBRARY_DIRS - directories in which the libraries are situated
37 #
38 # propagate these properties from one build system to the other
39+get_filename_component(_p8-platform_rootdir ${CMAKE_CURRENT_LIST_DIR}/../ ABSOLUTE)
40+
41 set (p8-platform_VERSION "@p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@")
42-set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX@/include)
43-set (p8-platform_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
44+set (p8-platform_INCLUDE_DIRS "${_p8-platform_rootdir}/include" "${_p8-platform_rootdir}/include/p8-platform")
45+if(WIN32)
46+ list(APPEND p8-platform_INCLUDE_DIRS "${_p8-platform_rootdir}/include/p8-platform/windows")
47+endif(WIN32)
48+set (p8-platform_LIBRARY_DIRS "${_p8-platform_rootdir}")
49 set (p8-platform_LINKER_FLAGS "@p8-platform_LINKER_FLAGS@")
50 set (p8-platform_CONFIG_VARS "@p8-platform_CONFIG_VARS@")
51
52 # libraries come from the build tree where this file was generated
53 if(WIN32)
54- set (p8-platform_LIBRARY "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/p8-platform.lib")
55+ set (p8-platform_LIBRARY "${_p8-platform_rootdir}/p8-platform.lib")
56 else(WIN32)
57- set (p8-platform_LIBRARY "-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -lp8-platform")
58+ set (p8-platform_LIBRARY "-L${_p8-platform_rootdir} -lp8-platform")
59 endif(WIN32)
60 set (p8-platform_LIBRARIES ${p8-platform_LIBRARY} "@p8-platform_LIBRARIES@")
61 mark_as_advanced (p8-platform_LIBRARY)
62--
632.11.0
64