mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-10-01 17:29:07 +08:00

The `install(TARGETS ...)` command in `cmake/ftxui_install.cmake` was missing required destination specifications that became mandatory in CMake 3.12+. This caused build failures when users tried to install FTXUI with the minimum supported CMake version. The issue occurred because the install command: ```cmake install( TARGETS screen dom component EXPORT ftxui-targets ) ``` Was missing explicit destination specifications for different artifact types. CMake 3.12+ requires these destinations to be explicitly declared. This PR adds the required destination specifications: ```cmake install( TARGETS screen dom component EXPORT ftxui-targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) ``` The fix ensures that: - Static libraries (`.a` files) are installed to the archive destination - Shared libraries are installed to the library destination - Executables are installed to the runtime destination All destinations use CMake's standard directory variables for proper cross-platform compatibility. The change is backward compatible and maintains the same installation behavior while satisfying CMake 3.12+ requirements. Fixes #1118.
64 lines
2.3 KiB
CMake
64 lines
2.3 KiB
CMake
if(NOT FTXUI_ENABLE_INSTALL)
|
|
return()
|
|
endif()
|
|
|
|
include(GNUInstallDirs)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Install the library and its public headers into the standard subdirectories
|
|
# ------------------------------------------------------------------------------
|
|
install(
|
|
TARGETS screen dom component
|
|
EXPORT ftxui-targets
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
)
|
|
|
|
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::
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ftxui"
|
|
)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Create and install the ftuxi-config.cmake and ftuxi-config-version.cmake files
|
|
# needed to support users of find_package()
|
|
# ------------------------------------------------------------------------------
|
|
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"
|
|
)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# 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}/pkgconfig"
|
|
)
|