add yaml-cpp to target_link_libraries

This commit is contained in:
b1ek 2023-04-16 02:09:55 +10:00
parent c070286284
commit 27377f2f1e
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 12 additions and 2 deletions

View File

@ -42,7 +42,8 @@ endif()
# Add yaml-cpp # Add yaml-cpp
include(ExternalProject) include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external) 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" GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
) )
@ -50,13 +51,19 @@ ExternalProject_Add(yaml-cpp
include_directories(${EXTERNAL_INSTALL_LOCATION}/include) include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) 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 --- # # --- End external projects --- #
target_link_libraries(CuteSchedule target_link_libraries(CuteSchedule
PRIVATE PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Widgets
yaml-cpp
) )
set_target_properties(CuteSchedule PROPERTIES set_target_properties(CuteSchedule PROPERTIES

View File

@ -1,6 +1,9 @@
#include "src/mainwindow.h" #include "src/mainwindow.h"
#include <QApplication> #include <QApplication>
#include <iostream>
#include "yaml-cpp/yaml.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {