mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 10:40:00 +08:00
build: Check package version in find_package (#643)
Modify the `ftxui-config.cmake.in` file so that it includes `ftxui-targets.cmake`. This causes cmake to check the version is compatible with what the user requested. This patch also includes additional minor changes. Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
parent
22ebc823c9
commit
e2aff66b98
@ -1,7 +1,13 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
4.1.0
|
4.1.1
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Build
|
||||||
|
- Check version compatibility when using cmake find_package()
|
||||||
|
|
||||||
|
4.1.0 (abandonned)
|
||||||
-----
|
-----
|
||||||
|
|
||||||
### Component
|
### Component
|
||||||
|
@ -2,3 +2,5 @@
|
|||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
find_dependency(Threads)
|
find_dependency(Threads)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/ftxui-targets.cmake")
|
@ -3,41 +3,60 @@ if(NOT FTXUI_ENABLE_INSTALL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(TARGETS screen dom component
|
|
||||||
EXPORT ftxui-export
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY include/ftxui DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
# CMake package configuration for easy use of library in CMake
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
configure_package_config_file(ftxui-config.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
|
||||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
|
||||||
)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
ftxui-config-version.cmake
|
|
||||||
VERSION ${PACKAGE_VERSION}
|
|
||||||
COMPATIBILITY AnyNewerVersion
|
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui-config.cmake
|
# ------------------------------------------------------------------------------
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
# Install the library and its public headers into the standard subdirectories
|
||||||
)
|
# ------------------------------------------------------------------------------
|
||||||
install(EXPORT ftxui-export
|
install(
|
||||||
FILE ftxui-config-version.cmake
|
TARGETS screen dom component
|
||||||
|
EXPORT ftxui-targets
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY include/ftxui
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Install the exported cmake targets for use in other CMake projects.
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
install(
|
||||||
|
EXPORT ftxui-targets
|
||||||
NAMESPACE ftxui::
|
NAMESPACE ftxui::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||||
)
|
)
|
||||||
|
|
||||||
# pkg-config file for easy use of library in build systems other than CMake
|
# ------------------------------------------------------------------------------
|
||||||
configure_file(ftxui.pc.in
|
# Create and install the ftuxi-config.cmake and ftuxi-config-version.cmake files
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc
|
# needed to support users of find_package()
|
||||||
@ONLY)
|
# ------------------------------------------------------------------------------
|
||||||
|
configure_package_config_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/ftxui-config.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/ftxui/cmake
|
||||||
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake
|
||||||
|
VERSION ${PACKAGE_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/ftxui-config-version.cmake
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ftxui
|
||||||
|
)
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc
|
# ------------------------------------------------------------------------------
|
||||||
DESTINATION lib/pkgconfig
|
# Create and install pkg-config file for easy use of library in build systems
|
||||||
)
|
# other than CMake:
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
configure_file(ftxui.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc @ONLY)
|
||||||
|
install(
|
||||||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/ftxui.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user