From 27377f2f1eb63fb3c707d17836ed85ce2733e4b0 Mon Sep 17 00:00:00 2001 From: b1ek Date: Sun, 16 Apr 2023 02:09:55 +1000 Subject: [PATCH] add yaml-cpp to target_link_libraries --- CMakeLists.txt | 11 +++++++++-- main.cpp | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bad4015..1c59f0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,8 @@ endif() # Add yaml-cpp include(ExternalProject) set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external) -ExternalProject_Add(yaml-cpp + +ExternalProject_Add(yaml-cpp-src GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} ) @@ -50,13 +51,19 @@ ExternalProject_Add(yaml-cpp include_directories(${EXTERNAL_INSTALL_LOCATION}/include) link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) -add_dependencies(CuteSchedule yaml-cpp) +add_library(yaml-cpp UNKNOWN IMPORTED) +add_dependencies(CuteSchedule yaml-cpp-src) + +set_target_properties(yaml-cpp PROPERTIES + IMPORTED_LOCATION ${EXTERNAL_INSTALL_LOCATION}/lib/libyaml-cpp.a +) # --- End external projects --- # target_link_libraries(CuteSchedule PRIVATE Qt${QT_VERSION_MAJOR}::Widgets + yaml-cpp ) set_target_properties(CuteSchedule PROPERTIES diff --git a/main.cpp b/main.cpp index a438ec4..61c25a3 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,9 @@ #include "src/mainwindow.h" #include +#include + +#include "yaml-cpp/yaml.h" int main(int argc, char *argv[]) {