Findcereal.cmake 873 B

1234567891011121314151617181920212223242526
  1. set(_q "")
  2. if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
  3. set(_q QUIET)
  4. set(_quietly TRUE)
  5. endif()
  6. find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
  7. if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
  8. # Fall-back solution to find the Cereal serialization library header file
  9. include(CheckIncludeFileCXX)
  10. add_library(cereal INTERFACE)
  11. target_include_directories(cereal INTERFACE include)
  12. if (_quietly)
  13. set(CMAKE_REQUIRED_QUIET ON)
  14. endif()
  15. CHECK_INCLUDE_FILE_CXX("cereal/cereal.hpp" HAVE_CEREAL_H)
  16. if (NOT HAVE_CEREAL_H)
  17. if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
  18. message(FATAL_ERROR "Cereal library not found. Please install the dependency.")
  19. elseif(NOT _quietly)
  20. message(WARNING "Cereal library not found.")
  21. endif()
  22. endif ()
  23. endif()