mirror of https://github.com/rusefi/openblt.git
Refs #1596. Improved rpath handling in CMakeLists.txt.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@1005 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
6d5be72cf6
commit
256e9e74e9
|
@ -139,6 +139,16 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
#***************************************************************************************
|
||||||
|
# Search path
|
||||||
|
#****************************************************************************************
|
||||||
|
# Add the path of the executable to the library search path. This way the LibOpenBLT
|
||||||
|
# shared library can simply be in the same directory as the BootCommander executable.
|
||||||
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
|
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
|
||||||
|
|
||||||
|
|
||||||
#***************************************************************************************
|
#***************************************************************************************
|
||||||
# Targets
|
# Targets
|
||||||
#****************************************************************************************
|
#****************************************************************************************
|
||||||
|
@ -148,21 +158,8 @@ add_executable(
|
||||||
${PROG_SRCS}
|
${PROG_SRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add libraries. Note that when compiling with GNU GCC the path of the executable is
|
# Add libraries.
|
||||||
# added to the run-time search path for libraries. This way LibOpenBLT's shared
|
target_link_libraries(BootCommander ${LIBOPENBLT_LIBNAME})
|
||||||
# object file (.so) does not have to be installed in the Linux's library path as long
|
|
||||||
# as it is located in the same directory as BootCommander's executable.
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES GNU)
|
|
||||||
# According to the CMake docs, item names starting with '-', but not '-l' or
|
|
||||||
# '-framework', are treated as linker flags. This means "-Wl" type linker flags can be
|
|
||||||
# specified here. Use this to add the path of the executable to the library search
|
|
||||||
# path. This way the LibOpenBLT shared library can simply be in the same directory as
|
|
||||||
# the BootCommander executable.
|
|
||||||
target_link_libraries(BootCommander ${LIBOPENBLT_LIBNAME} "-Wl,-rpath,.")
|
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES MSVC)
|
|
||||||
target_link_libraries(BootCommander ${LIBOPENBLT_LIBNAME})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Only generate the PC-lint taget if the option is enabled. Use "make BootCommander_LINT"
|
# Only generate the PC-lint taget if the option is enabled. Use "make BootCommander_LINT"
|
||||||
# to lint the project sources
|
# to lint the project sources
|
||||||
|
|
|
@ -157,6 +157,17 @@ set(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#***************************************************************************************
|
||||||
|
# Search path
|
||||||
|
#****************************************************************************************
|
||||||
|
# Add the path of the shared library to the library search path. This way an (optional)
|
||||||
|
# seed and key shared library file can simply be in the same directory as the LibOpenBLT
|
||||||
|
# shared library.
|
||||||
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||||
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
|
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
|
||||||
|
|
||||||
|
|
||||||
#***************************************************************************************
|
#***************************************************************************************
|
||||||
# Targets
|
# Targets
|
||||||
#****************************************************************************************
|
#****************************************************************************************
|
||||||
|
@ -177,16 +188,11 @@ if(BUILD_SHARED)
|
||||||
add_library(openblt_shared SHARED ${LIB_SRCS})
|
add_library(openblt_shared SHARED ${LIB_SRCS})
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
# Under Unix the LibUsb library (http://libusb.info/) is needed for the USB support.
|
# Under Unix the LibUsb library (http://libusb.info/) is needed for the USB support.
|
||||||
# Make sure the libusb-1.0-0 and libusb-1.0-0-dev packages are installed to be able to
|
# Make sure the libusb-1.0-0 and libusb-1.0-0-dev packages are installed to be able
|
||||||
# build LibOpenBLT. Example under Debian/Ubuntu:
|
# to build LibOpenBLT. Example under Debian/Ubuntu:
|
||||||
# sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
|
# sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
|
||||||
# Additionally, the LibDL is needed for dynamic library loading.
|
# Additionally, the LibDL is needed for dynamic library loading.
|
||||||
# According to the CMake docs, item names starting with '-', but not '-l' or
|
target_link_libraries(openblt_shared usb-1.0 dl)
|
||||||
# '-framework', are treated as linker flags. This means "-Wl" type linker flags can be
|
|
||||||
# specified here. Use this to add the path of the shared library to the library search
|
|
||||||
# path. This way an (optional) seed and key shared library file can simply be in the
|
|
||||||
# same directory as the LibOpenBLT shared library.
|
|
||||||
target_link_libraries(openblt_shared usb-1.0 dl "-Wl,-rpath,.")
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
# Link the Winsock library
|
# Link the Winsock library
|
||||||
target_link_libraries(openblt_shared ws2_32 winusb setupapi)
|
target_link_libraries(openblt_shared ws2_32 winusb setupapi)
|
||||||
|
|
Loading…
Reference in New Issue