2024-12-10 09:19:35 +01:00
|
|
|
# FindO2.cmake - Find the O2 library using pkg-config
|
2017-05-15 08:59:33 -06:00
|
|
|
#
|
2024-12-10 09:19:35 +01:00
|
|
|
# This module defines:
|
|
|
|
# - `O2_FOUND` - Set to TRUE if the library is found.
|
|
|
|
# - `O2_INCLUDE_DIRS` - Include directories for the library.
|
|
|
|
# - `O2_LIBRARIES` - Libraries to link against.
|
|
|
|
# - The alias target `o2::o2` if the library is found.
|
2017-05-15 08:59:33 -06:00
|
|
|
|
2024-12-10 09:19:35 +01:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2017-05-15 08:59:33 -06:00
|
|
|
|
2024-12-10 09:19:35 +01:00
|
|
|
pkg_search_module(PC_O2 IMPORTED_TARGET o2)
|
2017-05-15 08:59:33 -06:00
|
|
|
|
2024-12-10 09:19:35 +01:00
|
|
|
if (PC_O2_FOUND)
|
|
|
|
set(O2_FOUND TRUE)
|
|
|
|
set(O2_INCLUDE_DIRS ${PC_O2_INCLUDE_DIRS})
|
|
|
|
set(O2_LIBRARIES ${PC_O2_LIBRARIES})
|
2017-05-15 08:59:33 -06:00
|
|
|
|
2024-12-10 09:19:35 +01:00
|
|
|
add_library(o2::o2 ALIAS PkgConfig::PC_O2)
|
|
|
|
else()
|
|
|
|
set(O2_FOUND FALSE)
|
|
|
|
if (NOT O2_FIND_QUIETLY)
|
|
|
|
message(WARNING "O2 library not found via pkg-config.")
|
|
|
|
endif()
|
|
|
|
if (O2_FIND_REQUIRED)
|
|
|
|
message(FATAL_ERROR "O2 library is required but was not found.")
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-05-15 08:59:33 -06:00
|
|
|
|
2024-12-10 09:19:35 +01:00
|
|
|
# Mark results for cache
|
|
|
|
mark_as_advanced(O2_INCLUDE_DIRS O2_LIBRARIES)
|