Updated CMake recipes and changed file structure.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
083a08beb8
commit
b4e845a352
|
@ -1,47 +1,62 @@
|
||||||
cmake_minimum_required (VERSION 3.2)
|
# Support version 3.6 and above, but use policy settings up to 3.14.
|
||||||
|
# 3.6 is needed because of IMPORTED_TARGET in pkg_check_modules().
|
||||||
|
cmake_minimum_required(VERSION 3.6...3.14)
|
||||||
|
# Ranges are supported from 3.12, set policy to current for < 3.12.
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||||
|
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
project(remwharead
|
project(remwharead
|
||||||
VERSION 0.6.3
|
VERSION 0.6.3
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX)
|
||||||
)
|
# DESCRIPTION was introduced in version 3.9.
|
||||||
|
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.9))
|
||||||
|
set(PROJECT_DESCRIPTION
|
||||||
|
"Saves URIs of things you want to remember in a database.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# All custom build switches.
|
||||||
|
option(WITH_MAN "Compile and install manpage." YES)
|
||||||
|
option(WITH_TESTS "Compile tests." NO)
|
||||||
|
option(WITH_MOZILLA "Build and install wrapper for Mozilla browsers." YES)
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries." YES)
|
||||||
|
set(MOZILLA_NMH_DIR "${CMAKE_INSTALL_LIBDIR}/mozilla/native-messaging-hosts"
|
||||||
|
CACHE PATH "Directory for the Mozilla extension wrapper.")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG
|
set(DEBUG_CXXFLAGS
|
||||||
"${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic -ftrapv \
|
"-Wall"
|
||||||
-fsanitize=undefined -g -Og -fno-omit-frame-pointer")
|
"-Wextra"
|
||||||
|
"-Wpedantic"
|
||||||
set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
|
"-ftrapv"
|
||||||
set(WITH_TESTS "NO" CACHE STRING "WITH_TESTS defaults to \"NO\"")
|
"-fsanitize=undefined"
|
||||||
set(WITH_MOZILLA "NO" CACHE STRING "WITH_MOZILLA defaults to \"NO\"")
|
"-g"
|
||||||
|
"-Og"
|
||||||
include(GNUInstallDirs)
|
"-fno-omit-frame-pointer")
|
||||||
|
set(DEBUG_LDFLAGS
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/src/lib)
|
"-fsanitize=undefined")
|
||||||
Include_directories(${PROJECT_BINARY_DIR})
|
add_compile_options("$<$<CONFIG:Debug>:${DEBUG_CXXFLAGS}>")
|
||||||
|
# add_link_options was introduced in version 3.13.
|
||||||
# Write version in header
|
if(${CMAKE_VERSION} VERSION_LESS 3.13)
|
||||||
configure_file(
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${DEBUG_LDFLAGS}")
|
||||||
"${PROJECT_SOURCE_DIR}/src/version.hpp.in"
|
else()
|
||||||
"${PROJECT_BINARY_DIR}/version.hpp"
|
add_link_options("$<$<CONFIG:Debug>:${DEBUG_LDFLAGS}>")
|
||||||
)
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
add_subdirectory(src/lib)
|
add_subdirectory(src/lib)
|
||||||
|
add_subdirectory(include)
|
||||||
add_subdirectory(src/cli)
|
add_subdirectory(src/cli)
|
||||||
|
add_subdirectory(pkg-config)
|
||||||
|
add_subdirectory(cmake)
|
||||||
|
|
||||||
if (WITH_MAN)
|
if (WITH_MAN)
|
||||||
add_custom_command(
|
add_subdirectory(man)
|
||||||
OUTPUT "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1"
|
|
||||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
|
|
||||||
DEPENDS "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.1.adoc"
|
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
|
|
||||||
ARGS ${PROJECT_VERSION})
|
|
||||||
add_custom_target(man ALL DEPENDS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1")
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1
|
|
||||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_MOZILLA)
|
if (WITH_MOZILLA)
|
||||||
|
@ -49,8 +64,6 @@ if (WITH_MOZILLA)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_TESTS)
|
if(WITH_TESTS)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/src/cli)
|
|
||||||
add_library(${PROJECT_NAME}_testlib SHARED src/cli/parse_options.cpp)
|
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ image::https://doc.schlomp.space/.remwharead/example_tags.png[Tags view, height=
|
||||||
== Usage
|
== Usage
|
||||||
|
|
||||||
See
|
See
|
||||||
https://schlomp.space/tastytea/remwharead/src/branch/main/remwharead.1.adoc[manpage].
|
https://schlomp.space/tastytea/remwharead/src/branch/main/man/remwharead.1.adoc[manpage].
|
||||||
|
|
||||||
=== In your programs
|
=== In your programs
|
||||||
|
|
||||||
|
@ -115,7 +115,8 @@ cmake --build .
|
||||||
* `-DWITH_TESTS=YES` to compile the tests.
|
* `-DWITH_TESTS=YES` to compile the tests.
|
||||||
* `-DWITH_MOZILLA=YES` to install the wrapper for the Mozilla extension.
|
* `-DWITH_MOZILLA=YES` to install the wrapper for the Mozilla extension.
|
||||||
* `-DMOZILLA_NMH_DIR` lets you set the directory for the Mozilla
|
* `-DMOZILLA_NMH_DIR` lets you set the directory for the Mozilla
|
||||||
extension. The complete path is `${CMAKE_INSTALL_PREFIX}/${MOZILLA_NMH_DIR}`.
|
extension wrapper. The complete path is
|
||||||
|
`${CMAKE_INSTALL_PREFIX}/${MOZILLA_NMH_DIR}`.
|
||||||
* One of:
|
* One of:
|
||||||
** `-DWITH_DEB=YES` if you want to be able to generate a deb-package.
|
** `-DWITH_DEB=YES` if you want to be able to generate a deb-package.
|
||||||
** `-DWITH_RPM=YES` if you want to be able to generate an rpm-package.
|
** `-DWITH_RPM=YES` if you want to be able to generate an rpm-package.
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
set(MOZILLA_NMH_DIR
|
set(INSTALL_MOZILLA_NMH_DIR "${CMAKE_INSTALL_PREFIX}/${MOZILLA_NMH_DIR}")
|
||||||
"${CMAKE_INSTALL_LIBDIR}/mozilla/native-messaging-hosts" CACHE STRING "")
|
|
||||||
set(INSTALL_MOZILLA_NMH_DIR
|
|
||||||
"${CMAKE_INSTALL_PREFIX}/${MOZILLA_NMH_DIR}")
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME}_wrapper ${PROJECT_NAME}_wrapper.cpp)
|
add_executable(${PROJECT_NAME}_wrapper ${PROJECT_NAME}_wrapper.cpp)
|
||||||
target_link_libraries(${PROJECT_NAME}_wrapper stdc++fs)
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}_wrapper PRIVATE stdc++fs)
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME}_wrapper DESTINATION ${MOZILLA_NMH_DIR})
|
install(TARGETS ${PROJECT_NAME}_wrapper DESTINATION ${MOZILLA_NMH_DIR})
|
||||||
|
|
||||||
add_custom_command(
|
configure_file("${PROJECT_NAME}.json.in"
|
||||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json" @ONLY)
|
||||||
WORKING_DIRECTORY
|
|
||||||
"${CMAKE_SOURCE_DIR}/browser-plugins/webextension/native-wrapper"
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json
|
||||||
DEPENDS "${PROJECT_NAME}.json"
|
|
||||||
COMMAND "./replace_nmh_dir.sh"
|
|
||||||
ARGS "${INSTALL_MOZILLA_NMH_DIR}"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json")
|
|
||||||
add_custom_target(nmh_replace ALL
|
|
||||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json")
|
|
||||||
install(
|
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.json
|
|
||||||
DESTINATION ${MOZILLA_NMH_DIR})
|
DESTINATION ${MOZILLA_NMH_DIR})
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"name": "remwharead",
|
|
||||||
"description": "Saves URIs of things you want to remember in a database.",
|
|
||||||
"path": "/usr/lib/mozilla/native-messaging-hosts/remwharead_wrapper",
|
|
||||||
"type": "stdio",
|
|
||||||
"allowed_extensions": [ "remwharead@tastytea.de" ]
|
|
||||||
}
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "remwharead",
|
||||||
|
"description": "@PROJECT_DESCRIPTION@",
|
||||||
|
"path": "@INSTALL_MOZILLA_NMH_DIR@",
|
||||||
|
"type": "stdio",
|
||||||
|
"allowed_extensions": [ "remwharead@tastytea.de" ]
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Replace directory in remwharead.json
|
|
||||||
|
|
||||||
sed 's|/usr/lib/mozilla/native-messaging-hosts|'"${1}"'|' remwharead.json > "${2}"
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
|
VERSION ${PACKAGE_VERSION}
|
||||||
|
COMPATIBILITY ExactVersion) # NOTE: Set to SameMajorVersion when stable.
|
||||||
|
|
||||||
|
install(EXPORT ${PROJECT_NAME}Targets
|
||||||
|
FILE "${PROJECT_NAME}Targets.cmake"
|
||||||
|
NAMESPACE "${PROJECT_NAME}::"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||||
|
|
||||||
|
configure_file("${PROJECT_NAME}Config.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
|
@ -0,0 +1,15 @@
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
find_dependency(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(libconfig++ REQUIRED IMPORTED_TARGET libconfig++)
|
||||||
|
pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp)
|
||||||
|
|
||||||
|
find_file(vsqlitepp NAMES "sqlite/connection.hpp"
|
||||||
|
PATHS ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
if("${vsqlitepp}" STREQUAL "vsqlitepp-NOTFOUND")
|
||||||
|
message(FATAL_ERROR "Could not find vsqlite++.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
|
@ -0,0 +1,5 @@
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
|
||||||
|
FILES_MATCHING PATTERN "*.hpp")
|
|
@ -0,0 +1,13 @@
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
DEPENDS "${PROJECT_NAME}.1.adoc"
|
||||||
|
COMMAND "${PROJECT_SOURCE_DIR}/man/build_manpage.sh"
|
||||||
|
ARGS "${PROJECT_VERSION}")
|
||||||
|
|
||||||
|
add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1")
|
||||||
|
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1
|
||||||
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|
@ -3,7 +3,7 @@
|
||||||
name="remwharead"
|
name="remwharead"
|
||||||
|
|
||||||
if [ -n "${1}" ]; then
|
if [ -n "${1}" ]; then
|
||||||
dir="$(dirname ${0})"
|
dir=$(dirname "${0}")
|
||||||
version=${1}
|
version=${1}
|
||||||
cp -vf "${dir}/${name}.1.adoc" .
|
cp -vf "${dir}/${name}.1.adoc" .
|
||||||
sed -Ei "s/(Revision: +)[0-9]+\.[0-9]\.[0-9]/\1${version}/" "${name}.1.adoc"
|
sed -Ei "s/(Revision: +)[0-9]+\.[0-9]\.[0-9]/\1${version}/" "${name}.1.adoc"
|
|
@ -0,0 +1,7 @@
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
configure_file("${PROJECT_NAME}.pc.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" @ONLY)
|
||||||
|
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
@ -0,0 +1,13 @@
|
||||||
|
name=@PROJECT_NAME@
|
||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||||
|
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||||
|
|
||||||
|
Name: ${name}
|
||||||
|
Description: @PROJECT_DESCRIPTION@
|
||||||
|
Version: @PROJECT_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Requires: curlpp
|
||||||
|
Libs: -L${libdir} -l${name} -lvsqlitepp -lstdc++fs
|
||||||
|
Requires.private: libxdg-basedir, icu-uc, icu-i18n
|
|
@ -1,13 +0,0 @@
|
||||||
name=@PROJECT_NAME@
|
|
||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
|
||||||
exec_prefix=${prefix}
|
|
||||||
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
|
||||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
|
||||||
|
|
||||||
Name: ${name}
|
|
||||||
Description: Saves, archives and retrieves URIs of things you want to remember.
|
|
||||||
Version: @PROJECT_VERSION@
|
|
||||||
Libs: -L${libdir} -l${name}
|
|
||||||
Cflags: -I${includedir}/${name}
|
|
||||||
Requires.private: curlpp, sqlite3, libxdg-basedir, icu-uc, icu-i18n
|
|
||||||
Libs.private: -lvsqlitepp
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Write version in header
|
||||||
|
configure_file("version.hpp.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/version.hpp")
|
|
@ -1,10 +1,17 @@
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/src/cli)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
file(GLOB sources_cli *.cpp)
|
file(GLOB sources_cli *.cpp)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME}-cli ${sources_cli})
|
add_executable(${PROJECT_NAME}-cli ${sources_cli})
|
||||||
target_link_libraries(${PROJECT_NAME}-cli ${PROJECT_NAME})
|
|
||||||
set_target_properties(${PROJECT_NAME}-cli
|
set_target_properties(${PROJECT_NAME}-cli
|
||||||
PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
|
PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME}-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
|
target_include_directories(${PROJECT_NAME}-cli
|
||||||
|
PRIVATE "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}-cli
|
||||||
|
PRIVATE ${PROJECT_NAME})
|
||||||
|
|
||||||
|
install(TARGETS ${PROJECT_NAME}-cli
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
|
@ -1,43 +1,32 @@
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
|
pkg_check_modules(libxdg-basedir REQUIRED IMPORTED_TARGET libxdg-basedir)
|
||||||
# sqlite3 is not a direct dependency, but vsqlite++ has no cmake- or pkg-config
|
pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp)
|
||||||
# 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)
|
|
||||||
pkg_check_modules(CURLPP REQUIRED curlpp)
|
|
||||||
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
||||||
|
|
||||||
include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
|
file(GLOB_RECURSE sources_lib *.cpp)
|
||||||
include_directories(${SQLITE3_INCLUDE_DIRS})
|
file(GLOB_RECURSE headers_lib ../../include/*.hpp)
|
||||||
include_directories(${CURLPP_INCLUDE_DIRS})
|
|
||||||
include_directories(${ICU_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
|
add_library(${PROJECT_NAME} "${sources_lib}" "${headers_lib}")
|
||||||
link_directories(${SQLITE3_LIBRARY_DIRS})
|
|
||||||
link_directories(${CURLPP_LIBRARY_DIRS})
|
|
||||||
link_directories(${ICU_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
file(GLOB sources_lib *.cpp export/*.cpp)
|
|
||||||
file(GLOB headers_lib *.hpp)
|
|
||||||
file(GLOB headers_lib_export export/*.hpp)
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED ${sources_lib})
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${LIBXDG_BASEDIR_LIBRARIES}
|
|
||||||
vsqlitepp stdc++fs ${CURLPP_LIBRARIES} ${ICU_LIBRARIES})
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
|
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR})
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
target_include_directories(${PROJECT_NAME}
|
||||||
install(FILES ${headers_lib}
|
PRIVATE
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
|
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>" # version.hpp
|
||||||
install(FILES ${headers_lib_export}
|
PUBLIC
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/export)
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||||
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
|
|
||||||
configure_file("${PROJECT_SOURCE_DIR}/remwharead.pc.in"
|
target_link_libraries(${PROJECT_NAME}
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/remwharead.pc" @ONLY)
|
PRIVATE PkgConfig::libxdg-basedir ICU::uc ICU::i18n
|
||||||
|
PUBLIC PkgConfig::curlpp vsqlitepp stdc++fs)
|
||||||
|
|
||||||
|
install(TARGETS ${PROJECT_NAME}
|
||||||
|
EXPORT "${PROJECT_NAME}Targets"
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/remwharead.pc"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <curlpp/cURLpp.hpp>
|
#include <curlpp/cURLpp.hpp>
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
#include "time.hpp"
|
#include "time.hpp"
|
||||||
#include "adoc.hpp"
|
#include "export/adoc.hpp"
|
||||||
|
|
||||||
namespace remwharead
|
namespace remwharead
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "sqlite.hpp"
|
#include "sqlite.hpp"
|
||||||
#include "bookmarks.hpp"
|
#include "export/bookmarks.hpp"
|
||||||
|
|
||||||
namespace remwharead
|
namespace remwharead
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "time.hpp"
|
#include "time.hpp"
|
||||||
#include "csv.hpp"
|
#include "export/csv.hpp"
|
||||||
|
|
||||||
namespace remwharead
|
namespace remwharead
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "export.hpp"
|
#include "export/export.hpp"
|
||||||
|
|
||||||
namespace remwharead
|
namespace remwharead
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "sqlite.hpp"
|
#include "sqlite.hpp"
|
||||||
#include "time.hpp"
|
#include "time.hpp"
|
||||||
#include "simple.hpp"
|
#include "export/simple.hpp"
|
||||||
|
|
||||||
namespace remwharead
|
namespace remwharead
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,21 +1,29 @@
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
|
# I'm linking the library into the testlib to get the include directories.
|
||||||
|
add_library(${PROJECT_NAME}_testlib ../src/cli/parse_options.cpp)
|
||||||
|
target_include_directories(${PROJECT_NAME}_testlib
|
||||||
|
PUBLIC "${PROJECT_BINARY_DIR}" "../src/cli")
|
||||||
|
target_link_libraries(${PROJECT_NAME}_testlib PUBLIC ${PROJECT_NAME})
|
||||||
|
|
||||||
file(GLOB sources_tests test_*.cpp)
|
file(GLOB sources_tests test_*.cpp)
|
||||||
|
|
||||||
find_package(Catch2)
|
find_package(Catch2 CONFIG)
|
||||||
if(Catch2_FOUND) # Catch 2.x
|
if(Catch2_FOUND) # Catch 2.x
|
||||||
include(Catch)
|
include(Catch)
|
||||||
add_executable(all_tests main.cpp ${sources_tests})
|
add_executable(all_tests main.cpp ${sources_tests})
|
||||||
target_link_libraries(all_tests
|
target_link_libraries(all_tests
|
||||||
Catch2::Catch2 ${PROJECT_NAME} ${PROJECT_NAME}_testlib)
|
PRIVATE Catch2::Catch2 ${PROJECT_NAME}_testlib)
|
||||||
target_include_directories(all_tests PRIVATE "/usr/include/catch2")
|
target_include_directories(all_tests PRIVATE "/usr/include/catch2")
|
||||||
catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}")
|
catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}")
|
||||||
else() # Catch 1.x
|
else() # Catch 1.x
|
||||||
if(EXISTS "/usr/include/catch.hpp")
|
if(EXISTS "/usr/include/catch.hpp")
|
||||||
message(STATUS "Catch 1.x found.")
|
message(STATUS "Catch 1.x found.")
|
||||||
foreach(src ${sources_tests})
|
foreach(src ${sources_tests})
|
||||||
get_filename_component(bin ${src} NAME_WE)
|
get_filename_component(bin ${src} NAME_WE)
|
||||||
add_executable(${bin} main.cpp ${src})
|
add_executable(${bin} main.cpp ${src})
|
||||||
target_link_libraries(${bin} ${PROJECT_NAME} ${PROJECT_NAME}_testlib)
|
target_link_libraries(${bin}
|
||||||
|
PRIVATE ${PROJECT_NAME} ${PROJECT_NAME}_testlib)
|
||||||
add_test(${bin} ${bin} "${EXTRA_TEST_ARGS}")
|
add_test(${bin} ${bin} "${EXTRA_TEST_ARGS}")
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
|
|
Loading…
Reference in New Issue