From d0f08563a5d9a8b5b5bcf773d4b9074e4149d4f2 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 6 Oct 2021 21:31:37 +0200 Subject: [PATCH] build: always enable CMake install rule in default configuration (#2636) This will simplify packaging recipes, it's not mandatory, but there is no reason to have it as an option if it does not imply any regressions. Relate-to: https://github.com/lvgl/lvgl/issues/2534 Signed-off-by: Philippe Coval --- CMakeLists.txt | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47e4dbcc8..3cb96e313 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,40 +85,40 @@ else() target_compile_options(lvgl_interface INTERFACE -Wno-unused-function) else(MICROPY_DIR) # without micropython, build lvgl and examples libs normally + # default linux build uses this scope add_library(lvgl STATIC ${SOURCES}) add_library(lvgl_examples STATIC ${EXAMPLE_SOURCES}) + + include_directories(${CMAKE_SOURCE_DIR}) + + # Lbrary and headers can be installed to system using make install + file(GLOB LVGL_PUBLIC_HEADERS + "${CMAKE_SOURCE_DIR}/lv_conf.h" + "${CMAKE_SOURCE_DIR}/lvgl.h") + + if("${LIB_INSTALL_DIR}" STREQUAL "") + set(LIB_INSTALL_DIR "lib") + endif() + if("${INC_INSTALL_DIR}" STREQUAL "") + set(INC_INSTALL_DIR "include/lvgl") + endif() + + install(DIRECTORY "${CMAKE_SOURCE_DIR}/src" + DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" + FILES_MATCHING + PATTERN "*.h") + + set_target_properties(lvgl PROPERTIES + OUTPUT_NAME lvgl + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") + + install(TARGETS lvgl + ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" + PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}") + endif(MICROPY_DIR) endif() -option(install "Enable install to system" OFF) -if(install) -include_directories(${CMAKE_SOURCE_DIR}) -file(GLOB LVGL_PUBLIC_HEADERS - "${CMAKE_SOURCE_DIR}/lv_conf.h" - "${CMAKE_SOURCE_DIR}/lvgl.h") - - -if("${LIB_INSTALL_DIR}" STREQUAL "") - set(LIB_INSTALL_DIR "lib") -endif() - -if("${INC_INSTALL_DIR}" STREQUAL "") - set(INC_INSTALL_DIR "include/lvgl") -endif() - -install(DIRECTORY "${CMAKE_SOURCE_DIR}/src" - DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" - FILES_MATCHING - PATTERN "*.h") - -set_target_properties(lvgl PROPERTIES - OUTPUT_NAME lvgl - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") - -install(TARGETS lvgl - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" - PUBLIC_HEADER DESTINATION "${INC_INSTALL_DIR}") -endif(install)