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