|
| 1 | +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| 2 | +# file Copyright.txt or https://cmake.org/licensing for details. |
| 3 | + |
| 4 | +#[=======================================================================[.rst: |
| 5 | +FindAcesContainer |
| 6 | +------- |
| 7 | +
|
| 8 | +Finds the AcesContainer library. |
| 9 | +
|
| 10 | +Imported Targets |
| 11 | +^^^^^^^^^^^^^^^^ |
| 12 | +
|
| 13 | +This module provides the following imported targets, if found: |
| 14 | +
|
| 15 | +``AcesContainer::AcesContainer`` |
| 16 | + The AcesContainer library |
| 17 | +
|
| 18 | +Result Variables |
| 19 | +^^^^^^^^^^^^^^^^ |
| 20 | +
|
| 21 | +This will define the following variables: |
| 22 | +
|
| 23 | +``AcesContainer_FOUND`` |
| 24 | + True if the system has the AcesContainer library. |
| 25 | +``AcesContainer_VERSION`` |
| 26 | + The version of the AcesContainer library which was found. |
| 27 | +``AcesContainer_INCLUDE_DIRS`` |
| 28 | + Include directories needed to use AcesContainer. |
| 29 | +``AcesContainer_LIBRARIES`` |
| 30 | + Libraries needed to link to AcesContainer. |
| 31 | +
|
| 32 | +Cache Variables |
| 33 | +^^^^^^^^^^^^^^^ |
| 34 | +
|
| 35 | +The following cache variables may also be set: |
| 36 | +
|
| 37 | +``AcesContainer_INCLUDE_DIR`` |
| 38 | + The directory containing ``AcesContainer.h``. |
| 39 | +``AcesContainer_LIBRARY`` |
| 40 | + The path to the AcesContainer library. |
| 41 | +
|
| 42 | +#]=======================================================================] |
| 43 | + |
| 44 | +cmake_minimum_required(VERSION 3.12) |
| 45 | +include(GNUInstallDirs) |
| 46 | + |
| 47 | +message(STATUS "running FindAcesContainer.cmake") |
| 48 | + |
| 49 | +# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules |
| 50 | + |
| 51 | +find_package(PkgConfig) |
| 52 | +pkg_check_modules(PC_AcesContainer QUIET AcesContainer) |
| 53 | + |
| 54 | +find_path(AcesContainer_INCLUDE_DIR |
| 55 | + NAMES aces_Writer.h |
| 56 | + #PATHS ${PC_AcesContainer_INCLUDE_DIRS} |
| 57 | + PATHS /usr/local/include/ |
| 58 | + PATH_SUFFIXES aces |
| 59 | +) |
| 60 | +find_library(AcesContainer_LIBRARY |
| 61 | + NAMES AcesContainer |
| 62 | + #PATHS ${PC_AcesContainer_LIBRARY_DIRS} |
| 63 | + PATHS /usr/local/lib/ |
| 64 | +) |
| 65 | + |
| 66 | +find_library(AcesContainer_LIBRARY_RELEASE |
| 67 | + NAMES AcesContainer |
| 68 | + PATHS ${PC_AcesContainer_LIBRARY_DIRS}/Release |
| 69 | +) |
| 70 | +find_library(AcesContainer_LIBRARY_DEBUG |
| 71 | + NAMES AcesContainer |
| 72 | + PATHS ${PC_AcesContainer_LIBRARY_DIRS}/Debug |
| 73 | +) |
| 74 | + |
| 75 | +include(SelectLibraryConfigurations) |
| 76 | +select_library_configurations(AcesContainer) |
| 77 | + |
| 78 | +set(AcesContainer_VERSION ${PC_AcesContainer_VERSION}) |
| 79 | + |
| 80 | +include(FindPackageHandleStandardArgs) |
| 81 | +find_package_handle_standard_args(AcesContainer |
| 82 | + FOUND_VAR AcesContainer_FOUND |
| 83 | + REQUIRED_VARS |
| 84 | + AcesContainer_LIBRARY |
| 85 | + AcesContainer_INCLUDE_DIR |
| 86 | + VERSION_VAR AcesContainer_VERSION |
| 87 | +) |
| 88 | + |
| 89 | +if(AcesContainer_FOUND) |
| 90 | + set(AcesContainer_LIBRARIES ${AcesContainer_LIBRARY}) |
| 91 | + set(AcesContainer_INCLUDE_DIRS ${AcesContainer_INCLUDE_DIR}) |
| 92 | + set(AcesContainer_DEFINITIONS ${PC_AcesContainer_CFLAGS_OTHER}) |
| 93 | +endif() |
| 94 | + |
| 95 | +if(AcesContainer_FOUND AND NOT TARGET AcesContainer::AcesContainer) |
| 96 | + add_library(AcesContainer::AcesContainer UNKNOWN IMPORTED) |
| 97 | + set_target_properties(AcesContainer::AcesContainer PROPERTIES |
| 98 | + IMPORTED_LOCATION "${AcesContainer_LIBRARY}" |
| 99 | + INTERFACE_COMPILE_OPTIONS "${PC_AcesContainer_CFLAGS_OTHER}" |
| 100 | + INTERFACE_INCLUDE_DIRECTORIES "${AcesContainer_INCLUDE_DIR}" |
| 101 | + ) |
| 102 | +endif() |
| 103 | + |
| 104 | +if(AcesContainer_FOUND) |
| 105 | + if (NOT TARGET AcesContainer::AcesContainer) |
| 106 | + add_library(AcesContainer::AcesContainer UNKNOWN IMPORTED) |
| 107 | + endif() |
| 108 | + if (AcesContainer_LIBRARY_RELEASE) |
| 109 | + set_property(TARGET AcesContainer::AcesContainer APPEND PROPERTY |
| 110 | + IMPORTED_CONFIGURATIONS RELEASE |
| 111 | + ) |
| 112 | + set_target_properties(AcesContainer::AcesContainer PROPERTIES |
| 113 | + IMPORTED_LOCATION_RELEASE "${AcesContainer_LIBRARY_RELEASE}" |
| 114 | + ) |
| 115 | + endif() |
| 116 | + if (AcesContainer_LIBRARY_DEBUG) |
| 117 | + set_property(TARGET AcesContainer::AcesContainer APPEND PROPERTY |
| 118 | + IMPORTED_CONFIGURATIONS DEBUG |
| 119 | + ) |
| 120 | + set_target_properties(AcesContainer::AcesContainer PROPERTIES |
| 121 | + IMPORTED_LOCATION_DEBUG "${AcesContainer_LIBRARY_DEBUG}" |
| 122 | + ) |
| 123 | + endif() |
| 124 | + set_target_properties(AcesContainer::AcesContainer PROPERTIES |
| 125 | + INTERFACE_COMPILE_OPTIONS "${PC_AcesContainer_CFLAGS_OTHER}" |
| 126 | + INTERFACE_INCLUDE_DIRECTORIES "${AcesContainer_INCLUDE_DIR}" |
| 127 | + ) |
| 128 | +endif() |
| 129 | + |
| 130 | +mark_as_advanced( |
| 131 | + AcesContainer_INCLUDE_DIR |
| 132 | + AcesContainer_LIBRARY |
| 133 | +) |
| 134 | + |
| 135 | +# compatibility variables |
| 136 | +set(AcesContainer_VERSION_STRING ${AcesContainer_VERSION}) |
| 137 | + |
| 138 | + |
| 139 | + |
0 commit comments