@@ -6,15 +6,42 @@ include(GNUInstallDirs)
66include (CMakePackageConfigHelpers )
77
88# ------------------------------------------------------------------------------
9- # Install the library and its public headers into the standard subdirectories
9+ # Install the library and its public headers into the standard subdirectories.
10+ # On multi-config generators (e.g. Visual Studio) both Debug and Release are
11+ # installed into separate lib/<config>/ subdirectories so they can coexist in
12+ # the same package without overwriting each other. Single-config generators
13+ # (Ninja, Make) keep the traditional flat lib/ layout.
14+ # Generator expressions in DESTINATION require CMake 3.20.
1015# ------------------------------------------------------------------------------
11- install (
12- TARGETS screen dom component ftxui
13- EXPORT ftxui-targets
14- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
15- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
16- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
16+ get_property (_ftxui_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
17+ if (_ftxui_isMultiConfig)
18+ if (CMAKE_VERSION VERSION_LESS "3.20" )
19+ message (WARNING
20+ "FTXUI: CMake >= 3.20 is required to install Debug and Release "
21+ "libraries into separate subdirectories on multi-config generators. "
22+ "Falling back to a flat lib/ layout (the two configurations will "
23+ "overwrite each other). Please upgrade CMake." )
24+ set (_ftxui_isMultiConfig FALSE )
25+ endif ()
26+ endif ()
27+
28+ if (_ftxui_isMultiConfig)
29+ install (
30+ TARGETS screen dom component ftxui
31+ EXPORT ftxui-targets
32+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} /$<CONFIG >"
33+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} /$<CONFIG >"
34+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} /$<CONFIG >"
35+ )
36+ else ()
37+ install (
38+ TARGETS screen dom component ftxui
39+ EXPORT ftxui-targets
40+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} "
41+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} "
42+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR} "
1743 )
44+ endif ()
1845
1946install (
2047 DIRECTORY include/ftxui
0 commit comments