From 5b583a4bd2929cd3ddac474ac869b5a7758bfedb Mon Sep 17 00:00:00 2001 From: Patrick Masselink Date: Wed, 17 Jul 2024 17:26:27 +0200 Subject: [PATCH] Set RUNPATH in installed targets and fix roundtrip example install Signed-off-by: Patrick Masselink --- CMakeLists.txt | 6 ++++++ examples/CMakeLists.txt | 4 ++-- examples/helloworld/CMakeLists.txt | 2 +- examples/roundtrip/CMakeLists.txt | 2 +- examples/throughput/CMakeLists.txt | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78e137b2..95455608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,12 @@ include(CMakePackageConfigHelpers) include(GNUInstallDirs) include(CTest) +if(APPLE) + set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}") +else() + set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") +endif() + set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") # Generate Config.cmake diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index abc2e0be..38edd12b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -40,12 +40,12 @@ add_subdirectory(throughput) install( FILES roundtrip/ping.cpp - roundtrip/ping.cpp + roundtrip/pong.cpp roundtrip/roundtrip_common.hpp roundtrip/RoundTrip.idl roundtrip/CMakeLists.txt roundtrip/readme.rst - DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}/throughput" + DESTINATION "${CMAKE_INSTALL_EXAMPLESDIR}/roundtrip" COMPONENT dev) add_subdirectory(roundtrip) diff --git a/examples/helloworld/CMakeLists.txt b/examples/helloworld/CMakeLists.txt index ecf0335c..ec229fa3 100644 --- a/examples/helloworld/CMakeLists.txt +++ b/examples/helloworld/CMakeLists.txt @@ -9,8 +9,8 @@ # # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # -project(helloworld LANGUAGES C CXX) cmake_minimum_required(VERSION 3.16) +project(helloworld LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17) diff --git a/examples/roundtrip/CMakeLists.txt b/examples/roundtrip/CMakeLists.txt index 0c584c87..c862a12c 100644 --- a/examples/roundtrip/CMakeLists.txt +++ b/examples/roundtrip/CMakeLists.txt @@ -9,8 +9,8 @@ # # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # -project(throughput LANGUAGES C CXX) cmake_minimum_required(VERSION 3.16) +project(throughput LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17) diff --git a/examples/throughput/CMakeLists.txt b/examples/throughput/CMakeLists.txt index 6c028e8a..ddf58973 100644 --- a/examples/throughput/CMakeLists.txt +++ b/examples/throughput/CMakeLists.txt @@ -9,8 +9,8 @@ # # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # -project(throughput LANGUAGES C CXX) cmake_minimum_required(VERSION 3.16) +project(throughput LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17)