diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-02 16:57:12 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-02 16:57:12 +0200 |
| commit | 059fa151856293a8b6bdf9b16d1b72f415f59df3 (patch) | |
| tree | 47c62980e0f91703c14592790552dfaeb806252e | |
| parent | 7a2f8ad2728d6eb5dcd0c0fc249e1b3f0f6f069a (diff) | |
| download | qtmaildir-059fa151856293a8b6bdf9b16d1b72f415f59df3.tar.gz qtmaildir-059fa151856293a8b6bdf9b16d1b72f415f59df3.zip | |
build: add CMake skeleton and dependency discovery
| -rw-r--r-- | CMakeLists.txt | 24 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/main.cpp | 10 | ||||
| -rw-r--r-- | src/main_placeholder.cpp | 3 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 6 |
5 files changed, 57 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9364240 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.21) +project(qtmaildir VERSION 0.1.0 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_AUTOMOC ON) + +find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets WebEngineWidgets Test) + +# notmuch ships no pkg-config file; locate it by hand. +find_path(NOTMUCH_INCLUDE_DIR notmuch.h) +find_library(NOTMUCH_LIBRARY NAMES notmuch) +if(NOT NOTMUCH_INCLUDE_DIR OR NOT NOTMUCH_LIBRARY) + message(FATAL_ERROR + "libnotmuch not found. Need notmuch.h and libnotmuch on the system.") +endif() +message(STATUS "Found notmuch: ${NOTMUCH_LIBRARY}") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(GMIME REQUIRED IMPORTED_TARGET gmime-3.0) + +enable_testing() +add_subdirectory(src) +add_subdirectory(tests) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e9e28e5 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,14 @@ +add_library(qtmaildir_lib STATIC + main_placeholder.cpp +) + +target_include_directories(qtmaildir_lib + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${NOTMUCH_INCLUDE_DIR}) + +target_link_libraries(qtmaildir_lib + PUBLIC Qt6::Widgets Qt6::WebEngineWidgets PkgConfig::GMIME ${NOTMUCH_LIBRARY}) + +add_executable(qtmaildir main.cpp) +target_link_libraries(qtmaildir PRIVATE qtmaildir_lib) + +install(TARGETS qtmaildir RUNTIME DESTINATION bin) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..9c7b977 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,10 @@ +#include <QApplication> +#include <QLabel> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QLabel label(QStringLiteral("qtmaildir")); + label.show(); + return app.exec(); +} diff --git a/src/main_placeholder.cpp b/src/main_placeholder.cpp new file mode 100644 index 0000000..9ddb3f2 --- /dev/null +++ b/src/main_placeholder.cpp @@ -0,0 +1,3 @@ +// Placeholder so the library target has a source file before real code lands. +// Removed in Task 2. +namespace { int qtmaildir_placeholder = 0; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..3344d4a --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,6 @@ +# add_qtmaildir_test(<name>) builds tests/test_<name>.cpp and registers it. +function(add_qtmaildir_test name) + add_executable(test_${name} test_${name}.cpp) + target_link_libraries(test_${name} PRIVATE qtmaildir_lib Qt6::Test) + add_test(NAME ${name} COMMAND test_${name}) +endfunction() |
