|
| 1 | +#------------------------------------------------------------------------------# |
| 2 | +# Distributed under the OSI-approved Apache License, Version 2.0. See |
| 3 | +# accompanying file Copyright.txt for details. |
| 4 | +#------------------------------------------------------------------------------# |
| 5 | +# |
| 6 | +# FindSCR |
| 7 | +# ----------- |
| 8 | +# |
| 9 | +# Try to find the SCR library |
| 10 | +# |
| 11 | +# This module defines the following variables: |
| 12 | +# |
| 13 | +# SCR_FOUND - System has SCR |
| 14 | +# SCR_INCLUDE_DIRS - The SCR include directory |
| 15 | +# SCR_LIBRARIES - Link these to use SCR |
| 16 | +# |
| 17 | +# and the following imported targets: |
| 18 | +# SCR::SCR - The SCR library target |
| 19 | +# |
| 20 | +# You can also set the following variable to help guide the search: |
| 21 | +# SCR_ROOT - The install prefix for SCR containing the |
| 22 | +# include and lib folders |
| 23 | +# Note: this can be set as a CMake variable or an |
| 24 | +# environment variable. If specified as a CMake |
| 25 | +# variable, it will override any setting specified |
| 26 | +# as an environment variable. |
| 27 | + |
| 28 | +if(NOT SCR_FOUND) |
| 29 | + if((NOT SCR_ROOT) AND (NOT (ENV{SCR_ROOT} STREQUAL ""))) |
| 30 | + set(SCR_ROOT "$ENV{SCR_ROOT}") |
| 31 | + endif() |
| 32 | + if(SCR_ROOT) |
| 33 | + set(SCR_INCLUDE_OPTS HINTS ${SCR_ROOT}/include NO_DEFAULT_PATHS) |
| 34 | + set(SCR_LIBRARY_OPTS |
| 35 | + HINTS ${SCR_ROOT}/lib ${SCR_ROOT}/lib64 |
| 36 | + NO_DEFAULT_PATHS |
| 37 | + ) |
| 38 | + endif() |
| 39 | + |
| 40 | + find_path(SCR_INCLUDE_DIR scr.h ${SCR_INCLUDE_OPTS}) |
| 41 | + find_library(SCR_LIBRARY NAMES scr ${SCR_LIBRARY_OPTS}) |
| 42 | + |
| 43 | + include(FindPackageHandleStandardArgs) |
| 44 | + find_package_handle_standard_args(SCR |
| 45 | + FOUND_VAR SCR_FOUND |
| 46 | + REQUIRED_VARS SCR_LIBRARY SCR_INCLUDE_DIR |
| 47 | + ) |
| 48 | + if(SCR_FOUND) |
| 49 | + set(SCR_INCLUDE_DIRS ${SCR_INCLUDE_DIR}) |
| 50 | + set(SCR_LIBRARIES ${SCR_LIBRARY}) |
| 51 | + if(SCR_FOUND AND NOT TARGET SCR::SCR) |
| 52 | + add_library(SCR::SCR UNKNOWN IMPORTED) |
| 53 | + set_target_properties(SCR::SCR PROPERTIES |
| 54 | + IMPORTED_LOCATION "${SCR_LIBRARY}" |
| 55 | + INTERFACE_LINK_LIBRARIES "${SCR_LIBRARIES}" |
| 56 | + INTERFACE_INCLUDE_DIRECTORIES "${SCR_INCLUDE_DIR}" |
| 57 | + ) |
| 58 | + endif() |
| 59 | + endif() |
| 60 | +endif() |
0 commit comments