From bf2b4af15a63cd199e6c2cc471ba773e27865d7e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 12 Dec 2023 15:46:06 +0100 Subject: [PATCH] Ensure we use RUNPATH for ovniver As cmake doesn't provide a way to use the RPATH or the RUNPATH, we explicitly set the --enable-new-dtags linker flag. If the flag is not supported by the compiler, the build is aborted. --- src/emu/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index b894965..0da80e8 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -74,10 +74,18 @@ target_link_libraries(ovnisort emu parson-static ovni-static) add_executable(ovnitop ovnitop.c) target_link_libraries(ovnitop emu parson-static ovni-static) +# For ovniver we need to ensure we use the RUNPATH not the RPATH. +include(CheckLinkerFlag) +check_linker_flag(C "-Wl,--enable-new-dtags" SUPPORT_ENABLE_NEW_DTAGS) +if (NOT SUPPORT_ENABLE_NEW_DTAGS) + message(FATAL_ERROR "Flag -Wl,--enable-new-dtags not supported, refusing to build ovniver") +endif() + add_executable(ovniver ovniver.c) target_link_libraries(ovniver ovni) set_property(TARGET ovniver PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") +target_link_options(ovniver PRIVATE "-Wl,--enable-new-dtags") set(USE_MPI ON CACHE BOOL "Use MPI (required by ovnisync)") if(USE_MPI)