aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-05-28 09:54:59 +0200
committerThomas White <taw@physics.org>2018-05-28 09:56:18 +0200
commit1f8702b379a9e35ac1a39cdce5b857e92fc8d2cc (patch)
tree53dfacdbbe897a81616fce20aa79ae7dd1f9a3e0
parent1d6d33fa8b48cdad26be44465477ec0c56f02741 (diff)
Fix linker run path
-rw-r--r--CMakeLists.txt3
-rw-r--r--libcrystfel/CMakeLists.txt18
2 files changed, 12 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 706c23b4..665aa482 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,8 +32,9 @@ set(CMAKE_C_STANDARD 99)
# Make programs work without LD_LIBRARY_PATH when installed to a non system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_RPATH}")
endif("${isSystemDir}" STREQUAL "-1")
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
# Common include directories and libraries
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt
index 5d0ee069..f6019b22 100644
--- a/libcrystfel/CMakeLists.txt
+++ b/libcrystfel/CMakeLists.txt
@@ -76,44 +76,46 @@ add_library(${PROJECT_NAME} SHARED
${LIBCRYSTFEL_FFTW_SOURCES}
${LIBCRYSTFEL_HEADERS})
+set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
+
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/src)
target_include_directories(${PROJECT_NAME} PRIVATE ${HDF5_INCLUDE_DIRS})
-target_link_libraries(${PROJECT_NAME} PRIVATE util ${HDF5_C_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} PUBLIC util ${HDF5_C_LIBRARIES})
if (XGANDALF_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${XGANDALF_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${XGANDALF_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${XGANDALF_LIBRARIES})
endif (XGANDALF_FOUND)
if (FDIP_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${FDIP_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${FDIP_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${FDIP_LIBRARIES})
endif (FDIP_FOUND)
if (PINKINDEXER_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${PINKINDEXER_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${PINKINDEXER_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${PINKINDEXER_LIBRARIES})
endif (PINKINDEXER_FOUND)
if (NBP_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${NBP_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${NBP_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${NBP_LIBRARIES})
endif (NBP_FOUND)
if (FFTW_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${FFTW_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${FFTW_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${FFTW_LIBRARIES})
endif (FFTW_FOUND)
if (CBF_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${CBF_INCLUDES})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${CBF_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${CBF_LIBRARIES})
endif (CBF_FOUND)
if (CURSES_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${CURSES_INCLUDE_DIRS})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${CURSES_LIBRARIES})
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${CURSES_LIBRARIES})
endif (CURSES_FOUND)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)