0001-Make-resulting-cmake-config-relocatable.patch 2.7 KB

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