libmambaConfig.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ############################################################################
  2. # Copyright (c) 2019, QuantStack and Mamba Contributors #
  3. # #
  4. # Distributed under the terms of the BSD 3-Clause License. #
  5. # #
  6. # The full license is in the file LICENSE, distributed with this software. #
  7. ############################################################################
  8. # libmamba cmake module
  9. # This module sets the following variables in your project::
  10. #
  11. # libmamba_FOUND - true if libmamba found on the system
  12. # libmamba_INCLUDE_DIRS - the directory containing libmamba headers
  13. # libmamba_LIBRARY - the library for dynamic linking
  14. # libmamba_STATIC_LIBRARY - the library for static linking
  15. # libmamba_FULL_STATIC_LIBRARY - the library for static linking, incl. static deps
  16. ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
  17. ####### Any changes to this file will be overwritten by the next CMake run ####
  18. ####### The input file was libmambaConfig.cmake.in ########
  19. get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
  20. macro(set_and_check _var _file)
  21. set(${_var} "${_file}")
  22. if(NOT EXISTS "${_file}")
  23. message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  24. endif()
  25. endmacro()
  26. macro(check_required_components _NAME)
  27. foreach(comp ${${_NAME}_FIND_COMPONENTS})
  28. if(NOT ${_NAME}_${comp}_FOUND)
  29. if(${_NAME}_FIND_REQUIRED_${comp})
  30. set(${_NAME}_FOUND FALSE)
  31. endif()
  32. endif()
  33. endforeach()
  34. endmacro()
  35. ####################################################################################
  36. set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}")
  37. include(CMakeFindDependencyMacro)
  38. find_dependency(fmt)
  39. find_dependency(nlohmann_json)
  40. find_dependency(spdlog)
  41. find_dependency(Threads)
  42. find_dependency(tl-expected)
  43. find_dependency(zstd)
  44. find_dependency(BZip2)
  45. if(NOT (TARGET libmamba OR TARGET libmamba-static))
  46. include("${CMAKE_CURRENT_LIST_DIR}/libmambaTargets.cmake")
  47. if (TARGET libmamba-static)
  48. get_target_property(libmamba_INCLUDE_DIR libmamba-static INTERFACE_INCLUDE_DIRECTORIES)
  49. get_target_property(libmamba_STATIC_LIBRARY libmamba-static LOCATION)
  50. endif ()
  51. if (TARGET libmamba)
  52. get_target_property(libmamba_INCLUDE_DIR libmamba INTERFACE_INCLUDE_DIRECTORIES)
  53. get_target_property(libmamba_LIBRARY libmamba LOCATION)
  54. endif ()
  55. endif()