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).
This commit is contained in:
parent
4495a4c739
commit
6f996d8eed
@ -1,9 +1,11 @@
|
||||
# Locate yaml-cpp
|
||||
#
|
||||
# This module defines
|
||||
# YAMLCPP_FOUND, if false, do not try to link to yaml-cpp
|
||||
# YAMLCPP_LIBRARY, where to find yaml-cpp
|
||||
# YAMLCPP_INCLUDE_DIR, where to find yaml.h
|
||||
# YAMLCPP_FOUND, if false, do not try to link to yaml-cpp
|
||||
# YAMLCPP_LIBRARY, where to find yaml-cpp
|
||||
# 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,
|
||||
# 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)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YAMLCPP DEFAULT_MSG 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(
|
||||
contextualprocesstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
ContextualProcessJob.cpp # Builds it a second time
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_fsresizer # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
if( TARGET fsresizertest )
|
||||
target_compile_definitions( fsresizertest PRIVATE ${_partition_defs} )
|
||||
|
@ -34,10 +34,9 @@ endif()
|
||||
|
||||
calamares_add_test(
|
||||
hostinfotest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
HostInfoJob.cpp
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
|
@ -10,10 +10,9 @@ calamares_add_plugin( initcpio
|
||||
|
||||
calamares_add_test(
|
||||
initcpiotest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_initcpio # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
|
@ -10,10 +10,9 @@ calamares_add_plugin( initramfs
|
||||
|
||||
calamares_add_test(
|
||||
initramfstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
calamares_job_initramfs # From above
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
|
@ -27,7 +27,7 @@ calamares_add_plugin( locale
|
||||
calamaresui
|
||||
Qt5::Network
|
||||
${geoip_libs}
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
|
@ -10,9 +10,8 @@ calamares_add_plugin( shellprocess
|
||||
|
||||
calamares_add_test(
|
||||
shellprocesstest
|
||||
GUI # It's not
|
||||
SOURCES
|
||||
Tests.cpp
|
||||
LIBRARIES
|
||||
${YAMLCPP_LIBRARY}
|
||||
yamlcpp
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user