2019-08-03 20:10:20 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2019-07-26 07:08:13 +02:00
|
|
|
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
2019-08-05 17:00:53 +02:00
|
|
|
# Some distributions do not contain Poco*Config.cmake recipes.
|
|
|
|
find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG)
|
2019-07-26 07:08:13 +02:00
|
|
|
|
2019-08-03 20:10:20 +02:00
|
|
|
file(GLOB_RECURSE sources_lib *.cpp)
|
|
|
|
file(GLOB_RECURSE headers_lib ../../include/*.hpp)
|
2019-07-26 07:08:13 +02:00
|
|
|
|
2019-08-03 20:10:20 +02:00
|
|
|
add_library(${PROJECT_NAME} "${sources_lib}" "${headers_lib}")
|
2019-07-26 20:57:12 +02:00
|
|
|
|
2019-07-26 07:08:13 +02:00
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION}
|
2019-08-03 20:10:20 +02:00
|
|
|
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR})
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PRIVATE
|
|
|
|
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>" # version.hpp
|
|
|
|
PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
|
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
2019-07-26 20:57:12 +02:00
|
|
|
|
2019-08-03 20:10:20 +02:00
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2019-08-05 18:40:36 +02:00
|
|
|
PRIVATE ICU::uc ICU::i18n
|
2019-08-04 18:46:53 +02:00
|
|
|
PUBLIC vsqlitepp stdc++fs)
|
2019-07-29 04:01:47 +02:00
|
|
|
|
2019-08-05 17:00:53 +02:00
|
|
|
# If no Poco*Config.cmake recipes are found, look for headers in standard dirs.
|
2019-08-04 20:04:55 +02:00
|
|
|
if(PocoNetSSL_FOUND)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2019-08-05 17:00:53 +02:00
|
|
|
PRIVATE Poco::Foundation Poco::Net Poco::NetSSL)
|
2019-08-04 20:04:55 +02:00
|
|
|
else()
|
|
|
|
find_file(Poco_h NAMES "Poco/Poco.h"
|
2019-08-04 22:25:04 +02:00
|
|
|
PATHS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
2019-08-04 20:04:55 +02:00
|
|
|
|
|
|
|
if("${Poco_h}" STREQUAL "Poco_h-NOTFOUND")
|
|
|
|
message(FATAL_ERROR "Could not find POCO.")
|
|
|
|
else()
|
|
|
|
message(WARNING
|
|
|
|
"Your distribution of POCO doesn't contain the *Config.cmake recipes, "
|
|
|
|
"but the files seem to be in the standard directories. "
|
|
|
|
"Let's hope this works.")
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2019-08-05 17:00:53 +02:00
|
|
|
PRIVATE PocoFoundation PocoNet PocoNetSSL)
|
2019-08-04 20:04:55 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-08-03 20:10:20 +02:00
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
|
|
EXPORT "${PROJECT_NAME}Targets"
|
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
2019-07-30 07:02:09 +02:00
|
|
|
|