21 lines
775 B
CMake
21 lines
775 B
CMake
|
cmake_minimum_required(VERSION 3.20)
|
||
|
project(basiccmake LANGUAGES CXX)
|
||
|
|
||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||
|
include(GlobalOptions)
|
||
|
include(GNUInstallDirs)
|
||
|
include(Format)
|
||
|
|
||
|
# keep PUBLIC dependencies in sync with cmake/config.cmake.in
|
||
|
#find_package(foo REQUIRED)
|
||
|
|
||
|
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}")
|