cmake: fix lib not populated and RPATH usage 35/23235/6
authorRomain Forlot <romain.forlot@iot.bzh>
Tue, 26 Nov 2019 11:23:45 +0000 (12:23 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 14:55:04 +0000 (15:55 +0100)
RPATH as to be used as target property.

Bug-AGL: SPEC-2988

Change-Id: Ifaa66ceafbe7ed5f7de553b14da2dd8c5b1e8f9d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
conf.d/cmake/config.cmake
low-can-binding/CMakeLists.txt

index b1dec8c..d7d5f43 100644 (file)
@@ -29,8 +29,6 @@ set(PROJECT_LICENSE "APL2.0")
 set(PROJECT_LANGUAGES "C;CXX")
 set(API_NAME "low-can")
 
-set(INSTALL_RPATH "$ORIGIN")
-
 # Where are stored the project configuration files
 # relative to the root project directory
 set(PROJECT_CMAKE_CONF_DIR "conf.d")
index cba07bf..ce66a8c 100644 (file)
@@ -63,6 +63,12 @@ PROJECT_TARGET_ADD(low-can)
 
        add_library(${TARGET_NAME} SHARED ${SOURCES_LIB} ${SOURCES_J1939} ${SOURCES_ISOTP})
 
+       # Binder exposes a unique public entry point
+       SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+       LABELS "LIBRARY"
+       IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.so
+       )
+
        TARGET_LINK_LIBRARIES(${TARGET_NAME}
                ini-config
                openxc-message-format
@@ -86,6 +92,7 @@ PROJECT_TARGET_ADD(low-can-binding)
                PREFIX "afb-"
                LABELS "BINDINGV3"
                LINK_FLAGS ${BINDINGS_LINK_FLAG}
+               INSTALL_RPATH "$ORIGIN"
                OUTPUT_NAME ${TARGET_NAME}
        )