From 5ccdd0f15ca3fc1c57b517bf325d572a5398e3cd Mon Sep 17 00:00:00 2001 From: Pierre-Jean Texier 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 [Upstream status: http://patchwork.ozlabs.org/patch/1103437/] --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3370232..efa9840 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,11 +19,9 @@ SET(include_HEADERS include(GNUInstallDirs) # for the CMAKE_INSTALL_LIBDIR variable -add_library(ubootenv SHARED ${libubootenv_SOURCES} ${include_HEADERS}) +add_library(ubootenv ${libubootenv_SOURCES} ${include_HEADERS}) SET_TARGET_PROPERTIES(ubootenv PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION}) -ADD_LIBRARY(ubootenv_static STATIC ${libubootenv_SOURCES} ${include_HEADERS}) -SET_TARGET_PROPERTIES(ubootenv_static PROPERTIES OUTPUT_NAME ubootenv) add_executable(fw_printenv fw_printenv.c) target_link_libraries(ubootenv z) if (NOT NO_YML_SUPPORT) @@ -33,7 +31,7 @@ endif(NOT NO_YML_SUPPORT) target_link_libraries(fw_printenv ubootenv) add_custom_target(fw_setenv ALL ${CMAKE_COMMAND} -E create_symlink fw_printenv fw_setenv) -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 (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fw_setenv DESTINATION ${CMAKE_INSTALL_BINDIR}) -- 2.43.0