mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
cmake: add back pre-"modern CMake targets" find variables
This commit is contained in:
parent
59494034d8
commit
3157451d57
@ -20,3 +20,32 @@ get_filename_component(VOLK_GNSSSDR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
if(NOT TARGET VolkGnsssdr::volkgnsssdr)
|
||||
include("${VOLK_GNSSSDR_CMAKE_DIR}/VolkGnsssdrTargets.cmake")
|
||||
endif()
|
||||
|
||||
# set VOLKGNSSSDR_FOUND to be set globally, for whether a compatible Volk GNSS-SDR
|
||||
# was found -- could be a correct enough version or any version depending
|
||||
# on how find_package was called.
|
||||
if(NOT TARGET Volkgnsssdr::volkgnsssdr)
|
||||
set(VOLKGNSSSDR_FOUND FALSE)
|
||||
else()
|
||||
set(VOLKGNSSSDR_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
# cache whether a compatible VolkGnsssdr was found for
|
||||
# use anywhere in the calling project
|
||||
set(VOLKGNSSSDR_FOUND ${VOLKGNSSSDR_FOUND} CACHE BOOL "Whether a compatible Volk GNSS-SDR was found" FORCE)
|
||||
|
||||
if(VOLKGNSSSDR_FOUND)
|
||||
# use the new target library, regardless of whether new or old style
|
||||
# we still need to set a variable with the library name so that there
|
||||
# is a variable to reference in the using-project's cmake scripts!
|
||||
set(VOLK_GNSSSDR_LIBRARIES Volkgnsssdr::volkgnsssdr CACHE STRING "Volk GNSS-SDR Library" FORCE)
|
||||
|
||||
# INTERFACE_INCLUDE_DIRECTORIES should always be set
|
||||
get_target_property(VOLK_GNSSSDR_INCLUDE_DIRS Volkgnsssdr::volkgnsssdr INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(VOLK_GNSSSDR_INCLUDE_DIRS ${VOLK_GNSSSDR_INCLUDE_DIRS} CACHE STRING "Volk GNSS-SDR Include Directories" FORCE)
|
||||
|
||||
# for backward compatibility with old-CMake non-target project finding
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(VOLKGNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
|
||||
mark_as_advanced(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user