The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15708 
====================================================================== 
Reported By:                ovz
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15708
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-08-22 10:49 EDT
Last Modified:              2015-08-22 10:49 EDT
====================================================================== 
Summary:                    Use CMAKE_MACOSX_RPATH to link a library outside
build tree
Description: 
This issue is Mac OS X specific. I would like to link a library lib_xxx that
sits outside my build tree at some arbitrary location. It will be at the same
location in all systems. By default CMake would add the dependency as follows

@executable_path/libwupienginemac.dylib
I would like to know how to change @executable_path to either

1) Absolute path to the library. I see, for example the following in otool
output

/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
2) @rpath. I could then manage the location of lib_xxx using RPATH. I prefer
this option.

>From the documentation and forums it looks like CMAKE_MACOSX_RPATH should solve
the issue and implement option (2). Yet the CMakeLists.txt below still results
in @executable_path/libwupienginemac.dylib dependency.



Steps to Reproduce: 
cmake_minimum_required(VERSION 3.1)

project(xxx_test)

set(CMAKE_MACOSX_RPATH 1)
find_library(LIB_XXX lib_xxx
    PATHS "/path/to/lib_xxx/lib"
    )
if (NOT LIB_XXX)
    message(FATAL_ERROR ""LIB XXX not found")
 endif()

add_executable(xxx_test xxx_test.cpp)
target_link_libraries(xxx_test
    ${LIB_XXX}
)
# Try running the executable at once
add_custom_target(wibut_test_run ALL
    COMMAND xxx_test
    DEPENDS xxx_test
    )
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-08-22 10:49 ovz            New Issue                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to