I am trying to compile a program that calls libkpmcore; it is not graphical. My main interest is in tracing through what scandevices() does. Since KDE uses CMake, I figured I should too. But I'm having trouble getting the include paths (and quite possibly the libraries if I get past that) into the compiler
Eventually I got it to a state where it would call the compiler, but it couldn't find one of the libkpm headers: #include <backend/corebackendmanager.h> Adding (after finding and reading the source for KPMcoreConfig.cmake) set_target_properties(mypm PROPERTIES INCLUDE_DIRECTORIES ${KPMCORE_INCLUDE_DIR}) to CMakeLists.txt got past that, but then the next include failed: #include <QVector> Consulting Qt5Config.cmake showed that it in turn included various files with its components. I could go on like this, tracing through the includes, reviewing all the definitions, and updating include directories, link libraries, etc, as needed, but this is surely not the intended way to do things. I notice the CMakeLists.txt for partitionmanager, the main user of kpmcore, does not have that stuff. I've consulted the documentation for cmake and various tutorials, without much luck. Maybe the debian build system, which I am not using for my little test code, fills in some of the blanks? If cmake --help-module could actually find any of the modules it might save some work. I think the problem is that the modules are config modules, FooConfig, instead of find modules, FindFoo. I see no way to put --help-module into a mode where it will consider Config files. But even if that worked, I'd need to update the relevant paths. I think I have the relevant development files installed. Running on bullseye. Can anyone point me in the right direction? Thanks. Ross Boylan My current CMakeLists.txt: cmake_minimum_required(VERSION 3.0) project(mypm) set(QT_MIN_VERSION "5.3.0") set(KF5_MIN_VERSION "5.2.0") find_package(ECM 1.0.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) include(GenerateExportHeader) # Find Qt modules find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core # QCommandLineParser, QStringLiteral #Widgets # QApplication ) find_package(KPMcore CONFIG REQUIRED) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) set(mypm_SRCS test.cpp) add_executable(mypm ${mypm_SRCS}) # next gives mypm is not built by this project #target_include_directories(mypm, PRIVATE ${KPMCORE_INCLUDE_DIR}) set_target_properties(mypm PROPERTIES INCLUDE_DIRECTORIES ${KPMCORE_INCLUDE_DIR}) install(TARGETS mypm RUNTIME)