Prepared cmake recipe.

This commit is contained in:
tastytea 2019-05-12 21:39:01 +02:00
parent 17522d6757
commit 124ce0e280
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 19 additions and 7 deletions

View File

@ -9,7 +9,12 @@ set(WITH_TESTS "NO" CACHE STRING "WITH_TESTS defaults to \"NO\"")
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(CURLPP REQUIRED curlpp)
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
# sqlite3 is not a direct dependency, but vsqlite++ has no cmake- or pkg-config
# module. Since it installs in the same directories as sqlite3, I am adding the
# module here to add the include- and link directories below. It is not REQUIRED
# because the sqlite3 in Debian jessie doesn't come with a pkg-config module.
pkg_check_modules(SQLITE3 sqlite3)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -22,9 +27,14 @@ set(CMAKE_CXX_FLAGS_DEBUG
include_directories(${PROJECT_SOURCE_DIR}/src)
Include_directories(${PROJECT_BINARY_DIR})
include_directories(${CURLPP_INCLUDE_DIRS})
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
include_directories(${SQLITE3_INCLUDE_DIRS})
link_directories(${CURLPP_LIBRARY_DIRS})
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
link_directories(${SQLITE3_LIBRARY_DIRS})
set(COMMON_LIBRARIES
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp)
# Write version in header
configure_file(
@ -34,7 +44,7 @@ configure_file(
file(GLOB sources src/*.cpp)
add_executable(${PROJECT_NAME} "${sources}")
target_link_libraries(${PROJECT_NAME} ${CURLPP_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES})
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
if (WITH_MAN)
@ -52,6 +62,6 @@ endif()
if(WITH_TESTS)
add_library(${PROJECT_NAME}_testlib SHARED ${sources})
target_link_libraries(${PROJECT_NAME}_testlib ${CURLPP_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_testlib ${COMMON_LIBRARIES})
include(tests.CMakeLists.txt)
endif()

View File

@ -31,9 +31,11 @@ emerge -a www-misc/remwharead
* Tested OS: Linux
* C++ compiler (tested: https://gcc.gnu.org/[gcc] 5/6/7/8,
https://llvm.org/[clang] 3/5/6)
* https://cmake.org/[cmake] (at least: 3.6)
* https://cmake.org/[cmake] (at least: 3.2)
* https://pkgconfig.freedesktop.org/wiki/[pkgconfig] (tested: 0.29)
* http://www.curlpp.org/[curlpp] (tested: 0.8)
* http://repo.or.cz/w/libxdg-basedir.git[libxdg-basedir] (tested: 1.2)
* http://vsqlite.virtuosic-bytes.com/[vsqlite++] (tested: 0.3)
* https://github.com/badaix/popl[popl] (tested: 1.2)
* Optional:
** Manpage: http://asciidoc.org/[asciidoc] (tested: 8.6)