2019-05-22 18:32:36 +02:00
|
|
|
From 5448ca9d92f7fa197060323a82a5f060ce7c31e7 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Pierre-Jean Texier <pjtexier@koncepto.io>
|
|
|
|
Date: Wed, 22 May 2019 10:26:27 +0200
|
|
|
|
Subject: [PATCH] src/CMakeLists.txt: do not force the build of a shared
|
|
|
|
library
|
|
|
|
|
|
|
|
By definition, projects using CMake which can build either static or shared
|
|
|
|
libraries use a BUILD_SHARED_LIBS flag to allow selecting between both.
|
|
|
|
So, let CMake rely on the standard BUILD_SHARED_LIBS variable to decide
|
|
|
|
whether a static or shared library should be built.
|
|
|
|
|
|
|
|
however, we can control the behaviour as follows:
|
|
|
|
|
|
|
|
$. cmake -DBUILD_SHARED_LIBS=OFF ...
|
|
|
|
|
|
|
|
$. cmake -DBUILS_SHARED_LIBS=ON ...
|
|
|
|
|
|
|
|
With Yocto/OE, just add the following option into the libubootenv recipe :
|
|
|
|
|
|
|
|
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON"
|
|
|
|
|
|
|
|
Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
|
|
|
|
[Upstream status: http://patchwork.ozlabs.org/patch/1103437/]
|
|
|
|
---
|
2020-10-21 20:47:38 +02:00
|
|
|
src/CMakeLists.txt | 6 ++----
|
|
|
|
1 file changed, 2 insertions(+), 4 deletions(-)
|
2019-05-22 18:32:36 +02:00
|
|
|
|
|
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
2021-05-17 12:39:59 +02:00
|
|
|
index 4b71bc5..0b515f4 100644
|
2019-05-22 18:32:36 +02:00
|
|
|
--- a/src/CMakeLists.txt
|
|
|
|
+++ b/src/CMakeLists.txt
|
2021-05-17 12:39:59 +02:00
|
|
|
@@ -12,18 +12,16 @@ SET(include_HEADERS
|
2020-10-21 20:47:38 +02:00
|
|
|
|
|
|
|
include(GNUInstallDirs) # for the CMAKE_INSTALL_LIBDIR variable
|
2019-05-22 18:32:36 +02:00
|
|
|
|
|
|
|
-add_library(ubootenv SHARED ${libubootenv_SOURCES} ${include_HEADERS})
|
|
|
|
+add_library(ubootenv ${libubootenv_SOURCES} ${include_HEADERS})
|
2020-10-21 20:47:38 +02:00
|
|
|
SET_TARGET_PROPERTIES(ubootenv PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION})
|
2019-05-22 18:32:36 +02:00
|
|
|
|
|
|
|
-ADD_LIBRARY(ubootenv_static STATIC ${libubootenv_SOURCES} ${include_HEADERS})
|
2020-10-21 20:47:38 +02:00
|
|
|
-SET_TARGET_PROPERTIES(ubootenv_static PROPERTIES OUTPUT_NAME ubootenv)
|
2019-05-22 18:32:36 +02:00
|
|
|
add_executable(fw_printenv fw_printenv.c)
|
|
|
|
add_executable(fw_setenv fw_setenv.c)
|
2021-05-17 12:39:59 +02:00
|
|
|
target_link_libraries(ubootenv z)
|
|
|
|
target_link_libraries(fw_printenv ubootenv)
|
|
|
|
target_link_libraries(fw_setenv ubootenv)
|
2020-10-21 20:47:38 +02:00
|
|
|
|
|
|
|
-install (TARGETS ubootenv ubootenv_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
+install (TARGETS ubootenv DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
install (FILES libuboot.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
install (TARGETS fw_printenv DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
install (TARGETS fw_setenv DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2019-05-22 18:32:36 +02:00
|
|
|
--
|
2021-05-17 12:39:59 +02:00
|
|
|
2.30.2
|
2019-05-22 18:32:36 +02:00
|
|
|
|