Maurice Grönwoldt
5bb68a7d02
We have no make install support... so we don't need to have everything as a single-header and lib file.
49 lines
1.6 KiB
CMake
49 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
set(version 1.0)
|
|
project(VWeb VERSION ${version})
|
|
set(project_lower vweb)
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGSOFT")
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
|
|
include(CMakeMacros.txt)
|
|
|
|
add_subdirectory(Source)
|
|
add_subdirectory(Includes)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/)
|
|
get_property(source_files GLOBAL PROPERTY SRCS)
|
|
set(SOURCE_FILES ${source_files})
|
|
add_library(VWeb ${SOURCE_FILES})
|
|
|
|
include(GNUInstallDirs)
|
|
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
|
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
|
|
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
|
|
|
get_property(header_files GLOBAL PROPERTY Headers)
|
|
|
|
install(FILES ${header_files} DESTINATION include/VWeb-${version})
|
|
install(TARGETS ${PROJECT_NAME}
|
|
EXPORT ${PROJECT_NAME}-targets
|
|
LIBRARY DESTINATION lib/$<CONFIG>
|
|
ARCHIVE DESTINATION lib/$<CONFIG>
|
|
)
|
|
install(EXPORT ${PROJECT_NAME}-targets
|
|
DESTINATION lib/${PROJECT_NAME}-${version})
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/pkg/${project_lower}-config.cmake.in
|
|
${PROJECT_BINARY_DIR}/pkg/${project_lower}-config.cmake @ONLY)
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/${project_lower}-config-version.cmake.in
|
|
${PROJECT_BINARY_DIR}/${project_lower}-config-version.cmake @ONLY)
|
|
|
|
install(FILES ${PROJECT_BINARY_DIR}/pkg/${project_lower}-config.cmake
|
|
${PROJECT_BINARY_DIR}/${project_lower}-config-version.cmake
|
|
DESTINATION lib/${PROJECT_NAME}-${version}) |