From 912592de4ce0b6b1c74a56cded3f1a38b64bc6d4 Mon Sep 17 00:00:00 2001 From: Matt Leotta Date: Thu, 21 Jan 2016 16:07:56 -0500 Subject: [PATCH] Remove "INSTALL_NAME_DIR lib" target property The INSTALL_NAME_DIR property of a target specifies how a dynamic library should be found on OS X. If INSTALL_NAME_DIR is not specified the loader will search relative to the standard search paths. If specified it should either be an absolute path or relative path prefixed with either @executable_path, @load_path, or @rpath. Specifying "lib" does not make sense here and causes linking error as documented here: http://answers.opencv.org/question/4134/cmake-install_name_tool-absolute-path-for-library-on-mac-osx/ and here http://stackoverflow.com/questions/26978806/dyld-library-not-loaded-lib-libopencv-core-3-0-dylib-reason-image-not-found This patch removes INSTALL_NAME_DIR everywhere it is set to "lib". An alternate solution would be to set an absolute path like "${CMAKE_INSTALL_PREFIX}/lib" or relative path like "@executable_path/../lib". However, if there is not specific need for specifying a path, it is probably best left unset. --- apps/annotation/CMakeLists.txt | 1 - apps/haartraining/CMakeLists.txt | 1 - apps/traincascade/CMakeLists.txt | 1 - cmake/OpenCVModule.cmake | 1 - platforms/android/libinfo/CMakeLists.txt | 1 - 5 files changed, 5 deletions(-) diff --git a/apps/annotation/CMakeLists.txt b/apps/annotation/CMakeLists.txt index b34ef3904..54d89d953 100644 --- a/apps/annotation/CMakeLists.txt +++ b/apps/annotation/CMakeLists.txt @@ -20,7 +20,6 @@ set_target_properties(${the_target} PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} - INSTALL_NAME_DIR lib OUTPUT_NAME "opencv_annotation") if(ENABLE_SOLUTION_FOLDERS) diff --git a/apps/haartraining/CMakeLists.txt b/apps/haartraining/CMakeLists.txt index 35a26fe36..122d01ebf 100644 --- a/apps/haartraining/CMakeLists.txt +++ b/apps/haartraining/CMakeLists.txt @@ -38,7 +38,6 @@ set_target_properties(opencv_haartraining_engine PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} - INSTALL_NAME_DIR lib ) # ----------------------------------------------------------- diff --git a/apps/traincascade/CMakeLists.txt b/apps/traincascade/CMakeLists.txt index 941c0ec71..857604af1 100644 --- a/apps/traincascade/CMakeLists.txt +++ b/apps/traincascade/CMakeLists.txt @@ -26,7 +26,6 @@ set_target_properties(${the_target} PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} - INSTALL_NAME_DIR lib OUTPUT_NAME "opencv_traincascade") if(ENABLE_SOLUTION_FOLDERS) diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 88ebe54f7..418bf46fd 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -594,7 +594,6 @@ macro(ocv_create_module) ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} - INSTALL_NAME_DIR lib ) # For dynamic link numbering convenions diff --git a/platforms/android/libinfo/CMakeLists.txt b/platforms/android/libinfo/CMakeLists.txt index 592be2d04..010ac14da 100644 --- a/platforms/android/libinfo/CMakeLists.txt +++ b/platforms/android/libinfo/CMakeLists.txt @@ -34,7 +34,6 @@ add_library(opencv_info SHARED info.c) set_target_properties(${the_module} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} - INSTALL_NAME_DIR lib ) get_filename_component(lib_name "libopencv_info.so" NAME)