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