compat_config.cmake raw

   1  # Copyright (c) The Bitcoin Core developers
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  # compat_config.cmake -- compatibility workarounds meant to be included after
   6  # cmake find_package() calls are made, before configuring the ebuild
   7  
   8  # Define capnp_PREFIX if not defined to avoid issue on macos
   9  # https://github.com/bitcoin-core/libmultiprocess/issues/26
  10  
  11  if (NOT DEFINED capnp_PREFIX AND DEFINED CAPNP_INCLUDE_DIRS)
  12    get_filename_component(capnp_PREFIX "${CAPNP_INCLUDE_DIRS}" DIRECTORY)
  13  endif()
  14  
  15  if (NOT DEFINED CAPNPC_OUTPUT_DIR)
  16    set(CAPNPC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
  17  endif()
  18  
  19  # CMake target definitions for backwards compatibility with Ubuntu bionic
  20  # capnproto 0.6.1 package (https://packages.ubuntu.com/bionic/libcapnp-dev)
  21  # https://github.com/bitcoin-core/libmultiprocess/issues/27
  22  
  23  if (NOT DEFINED CAPNP_LIB_CAPNPC AND DEFINED CAPNP_LIB_CAPNP-RPC)
  24    string(REPLACE "-rpc" "c" CAPNP_LIB_CAPNPC "${CAPNP_LIB_CAPNP-RPC}")
  25  endif()
  26  
  27  if (NOT DEFINED CapnProto_capnpc_IMPORTED_LOCATION AND DEFINED CapnProto_capnp-rpc_IMPORTED_LOCATION)
  28    string(REPLACE "-rpc" "c" CapnProto_capnpc_IMPORTED_LOCATION "${CapnProto_capnp-rpc_IMPORTED_LOCATION}")
  29  endif()
  30  
  31  if (NOT TARGET CapnProto::capnp AND DEFINED CAPNP_LIB_CAPNP)
  32    add_library(CapnProto::capnp SHARED IMPORTED)
  33    set_target_properties(CapnProto::capnp PROPERTIES IMPORTED_LOCATION "${CAPNP_LIB_CAPNP}")
  34  endif()
  35  
  36  if (NOT TARGET CapnProto::capnpc AND DEFINED CAPNP_LIB_CAPNPC)
  37    add_library(CapnProto::capnpc SHARED IMPORTED)
  38    set_target_properties(CapnProto::capnpc PROPERTIES IMPORTED_LOCATION "${CAPNP_LIB_CAPNPC}")
  39  endif()
  40  
  41  if (NOT TARGET CapnProto::capnpc AND DEFINED CapnProto_capnpc_IMPORTED_LOCATION)
  42    add_library(CapnProto::capnpc SHARED IMPORTED)
  43    set_target_properties(CapnProto::capnpc PROPERTIES IMPORTED_LOCATION "${CapnProto_capnpc_IMPORTED_LOCATION}")
  44  endif()
  45  
  46  if (NOT TARGET CapnProto::capnp-rpc AND DEFINED CAPNP_LIB_CAPNP-RPC)
  47    add_library(CapnProto::capnp-rpc SHARED IMPORTED)
  48    set_target_properties(CapnProto::capnp-rpc PROPERTIES IMPORTED_LOCATION "${CAPNP_LIB_CAPNP-RPC}")
  49  endif()
  50  
  51  if (NOT TARGET CapnProto::kj AND DEFINED CAPNP_LIB_KJ)
  52    add_library(CapnProto::kj SHARED IMPORTED)
  53    set_target_properties(CapnProto::kj PROPERTIES IMPORTED_LOCATION "${CAPNP_LIB_KJ}")
  54  endif()
  55  
  56  if (NOT TARGET CapnProto::kj-async AND DEFINED CAPNP_LIB_KJ-ASYNC)
  57    add_library(CapnProto::kj-async SHARED IMPORTED)
  58    set_target_properties(CapnProto::kj-async PROPERTIES IMPORTED_LOCATION "${CAPNP_LIB_KJ-ASYNC}")
  59  endif()
  60