Update CMake config for src/.

This commit is contained in:
tastytea 2019-12-20 01:13:19 +01:00
parent e8b0e83bc8
commit 39ad18efc0
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 15 additions and 27 deletions

View File

@ -1,37 +1,25 @@
include(GNUInstallDirs)
find_package(CURL REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CURLPP REQUIRED curlpp)
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR})
# The minimum versions should be in Debian oldstable, if possible.
find_package(Boost 1.62 REQUIRED COMPONENTS system filesystem)
find_package(jsoncpp 1.7 REQUIRED CONFIG)
find_package(CURL 7.52 REQUIRED)
find_package(Threads REQUIRED)
find_package(restclient-cpp 0.5 REQUIRED CONFIG)
find_package(mastodon-cpp REQUIRED CONFIG)
include_directories(${CURL_INCLUDE_DIR})
include_directories(${CURLPP_INCLUDE_DIR})
include_directories(${JSONCPP_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${CURL_LIBRARY_DIRS})
link_directories(${CURLPP_LIBRARY_DIRS})
link_directories(${JSONCPP_LIBRARY_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
add_definitions(${Boost_DEFINITIONS})
# Write version in header
# Write version in header.
configure_file (
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
"${PROJECT_BINARY_DIR}/version.hpp"
)
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
"${PROJECT_BINARY_DIR}/version.hpp")
include_directories("${PROJECT_BINARY_DIR}")
file(GLOB sources *.cpp)
add_executable(mastorss ${sources})
target_link_libraries(mastorss
mastodon-cpp ${CURLPP_LIBRARIES}
${JSONCPP_LIBRARIES} ${Boost_LIBRARIES} stdc++fs)
install(TARGETS mastorss DESTINATION ${CMAKE_INSTALL_BINDIR})
mastodon-cpp::mastodon-cpp Boost::system Boost::filesystem restclient-cpp)
install(TARGETS mastorss DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES watchwords.json
DESTINATION ${CMAKE_INSTALL_DATADIR}/mastorss)
DESTINATION "${CMAKE_INSTALL_DATADIR}/mastorss")