CMake: give yamlcpp a proper imported target

- This makes linking easier,
 - Adds the right includes (needed on FreeBSD),
 - Lets us drop silly GUI setting for non-GUI tests (I think this was
   a side-effect of compiling on FreeBSD, where UI would pull in
   /usr/local/include).
main
Adriaan de Groot 5 years ago
parent 4495a4c739
commit 6f996d8eed

@ -1,9 +1,11 @@
# Locate yaml-cpp # Locate yaml-cpp
# #
# This module defines # This module defines
# YAMLCPP_FOUND, if false, do not try to link to yaml-cpp # YAMLCPP_FOUND, if false, do not try to link to yaml-cpp
# YAMLCPP_LIBRARY, where to find yaml-cpp # YAMLCPP_LIBRARY, where to find yaml-cpp
# YAMLCPP_INCLUDE_DIR, where to find yaml.h # YAMLCPP_INCLUDE_DIR, where to find yaml.h
# There is also one IMPORTED library target,
# yamlcpp
# #
# By default, the dynamic libraries of yaml-cpp will be found. To find the static ones instead, # By default, the dynamic libraries of yaml-cpp will be found. To find the static ones instead,
# you must set the YAMLCPP_STATIC_LIBRARY variable to TRUE before calling find_package(YamlCpp ...). # you must set the YAMLCPP_STATIC_LIBRARY variable to TRUE before calling find_package(YamlCpp ...).
@ -48,3 +50,12 @@ find_library(YAMLCPP_LIBRARY
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YAMLCPP DEFAULT_MSG YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(YAMLCPP DEFAULT_MSG YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY)
mark_as_advanced(YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY) mark_as_advanced(YAMLCPP_INCLUDE_DIR YAMLCPP_LIBRARY)
# Add an imported target
if( YAMLCPP_LIBRARY )
add_library( yamlcpp UNKNOWN IMPORTED )
set_property( TARGET yamlcpp PROPERTY IMPORTED_LOCATION ${YAMLCPP_LIBRARY} )
if ( YAMLCPP_INCLUDE_DIR )
set_property( TARGET yamlcpp PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${YAMLCPP_INCLUDE_DIR} )
endif()
endif()

@ -10,10 +10,9 @@ calamares_add_plugin( contextualprocess
calamares_add_test( calamares_add_test(
contextualprocesstest contextualprocesstest
GUI # It's not
SOURCES SOURCES
Tests.cpp Tests.cpp
ContextualProcessJob.cpp # Builds it a second time ContextualProcessJob.cpp # Builds it a second time
LIBRARIES LIBRARIES
${YAMLCPP_LIBRARY} yamlcpp
) )

@ -36,7 +36,7 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND
Tests.cpp Tests.cpp
LIBRARIES LIBRARIES
calamares_job_fsresizer # From above calamares_job_fsresizer # From above
${YAMLCPP_LIBRARY} yamlcpp
) )
if( TARGET fsresizertest ) if( TARGET fsresizertest )
target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} ) target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} )

@ -34,10 +34,9 @@ endif()
calamares_add_test( calamares_add_test(
hostinfotest hostinfotest
GUI # It's not
SOURCES SOURCES
Tests.cpp Tests.cpp
HostInfoJob.cpp HostInfoJob.cpp
LIBRARIES LIBRARIES
${YAMLCPP_LIBRARY} yamlcpp
) )

@ -10,10 +10,9 @@ calamares_add_plugin( initcpio
calamares_add_test( calamares_add_test(
initcpiotest initcpiotest
GUI # It's not
SOURCES SOURCES
Tests.cpp Tests.cpp
LIBRARIES LIBRARIES
calamares_job_initcpio # From above calamares_job_initcpio # From above
${YAMLCPP_LIBRARY} yamlcpp
) )

@ -10,10 +10,9 @@ calamares_add_plugin( initramfs
calamares_add_test( calamares_add_test(
initramfstest initramfstest
GUI # It's not
SOURCES SOURCES
Tests.cpp Tests.cpp
LIBRARIES LIBRARIES
calamares_job_initramfs # From above calamares_job_initramfs # From above
${YAMLCPP_LIBRARY} yamlcpp
) )

@ -27,7 +27,7 @@ calamares_add_plugin( locale
calamaresui calamaresui
Qt5::Network Qt5::Network
${geoip_libs} ${geoip_libs}
${YAMLCPP_LIBRARY} yamlcpp
SHARED_LIB SHARED_LIB
) )

@ -10,9 +10,8 @@ calamares_add_plugin( shellprocess
calamares_add_test( calamares_add_test(
shellprocesstest shellprocesstest
GUI # It's not
SOURCES SOURCES
Tests.cpp Tests.cpp
LIBRARIES LIBRARIES
${YAMLCPP_LIBRARY} yamlcpp
) )

Loading…
Cancel
Save