summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mohr <alexander.m.mohr@mercedes-benz.com>2023-05-17 09:09:53 +0200
committerGitHub <noreply@github.com>2023-05-17 09:09:53 +0200
commitf64063bf1dff1f05f95b11d4571ad6416faa81ae (patch)
tree2aa57bc48e4b71307f939090f47caf7b01025c1e
parent6005b92b34b3e3ffe43c59be544acd4688a3354c (diff)
downloadDLT-daemon-f64063bf1dff1f05f95b11d4571ad6416faa81ae.tar.gz
build: add static lib only if necessary (#479)
adding static library should only be enabled if the dlt library is build static. Adding this to the automotive-dlt.pc.in when static libraries are disabled yocto build will break Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
-rw-r--r--CMakeLists.txt6
-rw-r--r--automotive-dlt.pc.in2
2 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57044d6..ff53ceb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -209,6 +209,12 @@ else()
set(PACKAGE_DOC "")
endif()
+if (BUILD_SHARED_LIBS)
+ set(CMAKE_STATIC_LIB_PATH "")
+else()
+ set(CMAKE_STATIC_LIB_PATH "-L\$\{libdir\}/static")
+endif()
+
if(WITH_DLT_PKGCONFIG)
configure_file(${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)
configure_file(${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
diff --git a/automotive-dlt.pc.in b/automotive-dlt.pc.in
index 568b102..ddca060 100644
--- a/automotive-dlt.pc.in
+++ b/automotive-dlt.pc.in
@@ -22,6 +22,6 @@ Name: DLT
Description: Diagnostic Log and Trace
Version: @PROJECT_VERSION@
Requires:
-Libs: -L${libdir} -L${libdir}/static -ldlt -lrt -lpthread @ZLIB_LIBRARY@
+Libs: -L${libdir} @CMAKE_STATIC_LIB_PATH@ -ldlt -lrt -lpthread @ZLIB_LIBRARY@
Cflags: -I${includedir}/dlt -I${includedir} -DDLT_@PROJECT_VERSION_MAJOR@_@PROJECT_VERSION_MINOR@