fix(cmake): fix installation with cmake --install (#7161)

This commit is contained in:
Erik Tagirov 2024-11-05 13:16:05 +01:00 committed by GitHub
parent 0091be46fa
commit 3cfe1a8306
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -99,26 +99,25 @@ if("${INC_INSTALL_DIR}" STREQUAL "")
set(INC_INSTALL_DIR "include/lvgl") set(INC_INSTALL_DIR "include/lvgl")
endif() endif()
set(CMAKE_INSTALL_PREFIX .)
#Install headers #Install headers
install( install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" DESTINATION "${INC_INSTALL_DIR}"
FILES_MATCHING FILES_MATCHING
PATTERN "*.h") PATTERN "*.h")
# Install headers from the LVGL_PUBLIC_HEADERS variable # Install headers from the LVGL_PUBLIC_HEADERS variable
install( install(
FILES ${LVGL_PUBLIC_HEADERS} FILES ${LVGL_PUBLIC_HEADERS}
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" DESTINATION "${INC_INSTALL_DIR}/"
) )
# install example headers # install example headers
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES) if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
install( install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples" DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" DESTINATION "${INC_INSTALL_DIR}"
FILES_MATCHING FILES_MATCHING
PATTERN "*.h") PATTERN "*.h")
endif() endif()
@ -127,7 +126,7 @@ endif()
if(NOT LV_CONF_BUILD_DISABLE_DEMOS) if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
install( install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos" DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/demos"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/" DESTINATION "${INC_INSTALL_DIR}"
FILES_MATCHING FILES_MATCHING
PATTERN "*.h") PATTERN "*.h")
endif() endif()
@ -138,7 +137,7 @@ configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" ${CMAKE_CURRENT_BINARY_DIR}/lv
install( install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc" FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig/") DESTINATION "share/pkgconfig/")
# Install library # Install library
set_target_properties( set_target_properties(
@ -146,9 +145,8 @@ set_target_properties(
PROPERTIES OUTPUT_NAME lvgl PROPERTIES OUTPUT_NAME lvgl
VERSION ${LVGL_VERSION} VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION} SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install( install(
@ -166,9 +164,8 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
PROPERTIES OUTPUT_NAME lvgl_thorvg PROPERTIES OUTPUT_NAME lvgl_thorvg
VERSION ${LVGL_VERSION} VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION} SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install( install(
@ -186,9 +183,8 @@ if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
PROPERTIES OUTPUT_NAME lvgl_demos PROPERTIES OUTPUT_NAME lvgl_demos
VERSION ${LVGL_VERSION} VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION} SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install( install(
@ -206,9 +202,8 @@ if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
PROPERTIES OUTPUT_NAME lvgl_examples PROPERTIES OUTPUT_NAME lvgl_examples
VERSION ${LVGL_VERSION} VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION} SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}") PUBLIC_HEADER "${LVGL_PUBLIC_HEADERS}")
install( install(