Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2020-02-07 13:07:22 +0300
committertamasmeszaros <meszaros.q@gmail.com>2020-02-07 13:07:22 +0300
commit2fb1acd74b530c9b1cfd77ff5fd29896960b8189 (patch)
tree95775d77e1261836d644815d1d3ea46c120ae0ae /cmake/modules
parenta1c0a29af21b34d06baec2f07e023ee0fb81b66a (diff)
Add check for cereal library in CMake
Fixes #3547, replaces #3613
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/Findcereal.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/modules/Findcereal.cmake b/cmake/modules/Findcereal.cmake
new file mode 100644
index 000000000..b4829757e
--- /dev/null
+++ b/cmake/modules/Findcereal.cmake
@@ -0,0 +1,26 @@
+set(_q "")
+if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+ set(_q QUIET)
+ set(_quietly TRUE)
+endif()
+find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
+
+if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+ # Fall-back solution to find the Cereal serialization library header file
+ include(CheckIncludeFileCXX)
+ add_library(cereal INTERFACE)
+ target_include_directories(cereal INTERFACE include)
+
+ if (_quietly)
+ set(CMAKE_REQUIRED_QUIET ON)
+ endif()
+ CHECK_INCLUDE_FILE_CXX("cereal/cereal.hpp" HAVE_CEREAL_H)
+
+ if (NOT HAVE_CEREAL_H)
+ if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+ message(FATAL_ERROR "Cereal library not found. Please install the dependency.")
+ elseif(NOT _quietly)
+ message(WARNING "Cereal library not found.")
+ endif()
+ endif ()
+endif()