Commit dc513e03 authored by Ryan Pavlik's avatar Ryan Pavlik

cmake: Fix FindLibcheck - doesn't always require libsubunit

parent 917366a7
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
# #
# ``libcheck::check`` # ``libcheck::check``
# #
# ``libcheck::subunit``
#
# Cache variables # Cache variables
# ^^^^^^^^^^^^^^^ # ^^^^^^^^^^^^^^^
# #
...@@ -80,8 +78,6 @@ find_library(LIBCHECK_SUBUNIT_LIBRARY ...@@ -80,8 +78,6 @@ find_library(LIBCHECK_SUBUNIT_LIBRARY
find_library(LIBCHECK_LIBRT rt) find_library(LIBCHECK_LIBRT rt)
find_library(LIBCHECK_LIBM m) find_library(LIBCHECK_LIBM m)
# include(CMakeFindDependencyMacro)
# find_dependency(Threads)
find_package(Threads QUIET) find_package(Threads QUIET)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
...@@ -89,18 +85,9 @@ find_package_handle_standard_args(Libcheck ...@@ -89,18 +85,9 @@ find_package_handle_standard_args(Libcheck
REQUIRED_VARS REQUIRED_VARS
LIBCHECK_INCLUDE_DIR LIBCHECK_INCLUDE_DIR
LIBCHECK_LIBRARY LIBCHECK_LIBRARY
LIBCHECK_SUBUNIT_LIBRARY
THREADS_FOUND THREADS_FOUND
) )
if(LIBCHECK_FOUND) if(LIBCHECK_FOUND)
if(NOT TARGET libcheck::subunit)
add_library(libcheck::subunit UNKNOWN IMPORTED)
set_target_properties(libcheck::subunit PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBCHECK_INCLUDE_DIR}")
set_target_properties(libcheck::subunit PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${LIBCHECK_SUBUNIT_LIBRARY})
endif()
if(NOT TARGET libcheck::check) if(NOT TARGET libcheck::check)
add_library(libcheck::check UNKNOWN IMPORTED) add_library(libcheck::check UNKNOWN IMPORTED)
...@@ -110,16 +97,20 @@ if(LIBCHECK_FOUND) ...@@ -110,16 +97,20 @@ if(LIBCHECK_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION ${LIBCHECK_LIBRARY}) IMPORTED_LOCATION ${LIBCHECK_LIBRARY})
set_property(TARGET libcheck::check PROPERTY set_property(TARGET libcheck::check PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES libcheck::subunit Threads::Threads) IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads)
# if we found librt or libm, link them. # if we found librt or libm, link them.
if(LIBCHECK_LIBRT) if(LIBCHECK_LIBRT)
set_property(TARGET libcheck::check APPEND PROPERTY set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES ${LIBCHECK_LIBRT}) IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBRT}")
endif() endif()
if(LIBCHECK_LIBM) if(LIBCHECK_LIBM)
set_property(TARGET libcheck::check APPEND PROPERTY set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES ${LIBCHECK_LIBM}) IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_LIBM}")
endif()
if(LIBCHECK_SUBUNIT_LIBRARY)
set_property(TARGET libcheck::check APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES "${LIBCHECK_SUBUNIT_LIBRARY}")
endif() endif()
endif() endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment