2021-11-08 14:00:16 +00:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(basiccmake LANGUAGES CXX)
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
# keep PUBLIC dependencies in sync with cmake/config.cmake.in
|
|
|
|
#find_package(foo REQUIRED)
|
|
|
|
|
2022-11-06 03:09:33 +00:00
|
|
|
include(AddAutoformatTarget)
|
|
|
|
include(GlobalOptions)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2021-11-08 14:00:16 +00:00
|
|
|
add_subdirectory(src)
|
|
|
|
|
|
|
|
install(DIRECTORY include TYPE INCLUDE FILES_MATCHING PATTERN *.h)
|
|
|
|
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets)
|
|
|
|
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}::
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
|
|
|
|
configure_file(cmake/config.cmake.in ${PROJECT_NAME}-config.cmake @ONLY)
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}")
|