1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-25 04:27:39 +00:00

Add more imported targets to CMake scripts

This commit is contained in:
Carles Fernandez
2019-02-04 16:07:29 +01:00
parent 4f440f63dc
commit 9b94a4dec0
21 changed files with 207 additions and 116 deletions

View File

@@ -43,7 +43,10 @@
# PCAP_INCLUDE_DIRS - where to find pcap.h, etc.
# PCAP_LIBRARIES - List of libraries when using pcap.
# PCAP_FOUND - True if pcap found.
#
# Provides the following imported target:
# Pcap::pcap
#
if(EXISTS $ENV{PCAPDIR})
find_path(PCAP_INCLUDE_DIR
@@ -113,10 +116,20 @@ check_function_exists("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS)
check_function_exists("pcap_open_dead" HAVE_PCAP_OPEN_DEAD)
check_function_exists("pcap_set_datalink" HAVE_PCAP_SET_DATALINK)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES)
if(PCAP_FOUND AND NOT TARGET Pcap::pcap)
add_library(Pcap::pcap SHARED IMPORTED)
set_target_properties(Pcap::pcap PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${PCAP_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${PCAP_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${PCAP_LIBRARIES}"
)
endif()
mark_as_advanced(
PCAP_LIBRARIES
PCAP_INCLUDE_DIRS
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG PCAP_INCLUDE_DIRS PCAP_LIBRARIES)