mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
add find_package support.
This commit is contained in:
parent
f90f9b8e61
commit
fda2cddc70
@ -34,7 +34,12 @@ option(CROW_ENABLE_COMPRESSION "Enable compression capabilities (ZLIB)" OFF)
|
||||
#####################################
|
||||
add_library(Crow INTERFACE)
|
||||
add_library(Crow::Crow ALIAS Crow)
|
||||
target_include_directories(Crow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
target_include_directories(Crow
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
find_package(Boost 1.64 COMPONENTS system date_time REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
@ -86,7 +91,25 @@ endif()
|
||||
# Install Files
|
||||
#####################################
|
||||
if(CROW_INSTALL)
|
||||
install(TARGETS Crow EXPORT CrowTargets)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include)
|
||||
|
||||
install(EXPORT CrowTargets
|
||||
FILE CrowTargets.cmake
|
||||
NAMESPACE Crow::
|
||||
DESTINATION lib/cmake/Crow
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CrowConfig.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CrowConfig.cmake"
|
||||
INSTALL_DESTINATION lib/cmake/Crow
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CrowConfig.cmake"
|
||||
DESTINATION lib/cmake/Crow
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
|
19
cmake/CrowConfig.cmake.in
Normal file
19
cmake/CrowConfig.cmake.in
Normal file
@ -0,0 +1,19 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(CROW_ENABLE_COMPRESSION @CROW_ENABLE_COMPRESSION@)
|
||||
set(CROW_ENABLE_SSL @CROW_ENABLE_SSL@)
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Boost 1.64 COMPONENTS system date_time)
|
||||
find_dependency(Threads)
|
||||
|
||||
if(CROW_ENABLE_COMPRESSION)
|
||||
find_dependency(ZLIB)
|
||||
endif()
|
||||
|
||||
if(CROW_ENABLE_SSL)
|
||||
find_dependency(OpenSSL)
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/CrowTargets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
Loading…
Reference in New Issue
Block a user