1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
# - Try to find LibRice
#
# Copyright (C) 2025 Igalia S.L
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#[=======================================================================[.rst:
FindRice
--------------
Find Rice headers and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
``Rice::Proto``
The Rice proto library, if found.
``Rice::Io``
The Rice io library, if found.
#]=======================================================================]
find_package(PkgConfig QUIET)
if ("Proto" IN_LIST Rice_FIND_COMPONENTS)
pkg_check_modules(PC_RICE_PROTO rice-proto)
if (NOT Rice_VERSION)
set(Rice_VERSION ${PC_RICE_PROTO_VERSION})
endif ()
find_path(RiceProto_INCLUDE_DIR
NAMES rice-proto.h
HINTS ${PC_RICE_PROTO_INCLUDEDIR}
${PC_RICE_PROTO_INCLUDE_DIRS}
)
find_library(Rice_PROTO_LIBRARY
NAMES rice-proto
HINTS ${PC_RICE_PROTO_LIBDIR}
${PC_RICE_PROTO_LIBRARY_DIRS}
)
if (Rice_PROTO_LIBRARY)
set(Rice_Proto_FOUND TRUE)
endif ()
endif ()
if ("Io" IN_LIST Rice_FIND_COMPONENTS)
pkg_check_modules(PC_RICE_IO rice-io)
if (NOT Rice_VERSION)
set(Rice_VERSION ${PC_RICE_IO_VERSION})
endif ()
find_path(RiceIo_INCLUDE_DIR
NAMES rice-io.h
HINTS ${PC_RICE_IO_INCLUDEDIR}
${PC_RICE_IO_INCLUDE_DIRS}
)
find_library(Rice_IO_LIBRARY
NAMES rice-io
HINTS ${PC_RICE_IO_LIBDIR}
${PC_RICE_IO_LIBRARY_DIRS}
)
if (Rice_IO_LIBRARY)
set(Rice_Io_FOUND TRUE)
endif ()
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Rice
VERSION_VAR Rice_VERSION
HANDLE_COMPONENTS
)
if (Rice_PROTO_LIBRARY AND NOT TARGET Rice::Proto)
add_library(Rice::Proto UNKNOWN IMPORTED GLOBAL)
set_target_properties(Rice::Proto PROPERTIES
IMPORTED_LOCATION "${Rice_PROTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${RiceProto_INCLUDE_DIR}"
)
endif ()
if (Rice_IO_LIBRARY AND NOT TARGET Rice::Io)
add_library(Rice::Io UNKNOWN IMPORTED GLOBAL)
set_target_properties(Rice::Io PROPERTIES
IMPORTED_LOCATION "${Rice_IO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${RiceIo_INCLUDE_DIR}"
)
endif ()
mark_as_advanced(
Rice_PROTO_LIBRARY
Rice_IO_LIBRARY
)
|