aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-21 11:43:49 +0100
committerThomas White <taw@physics.org>2018-03-21 16:55:20 +0100
commit0b849787cd825f5d4e5b16f1e64552ecb10d0b76 (patch)
tree44d1f0e017710e913c6d695bcb6b68edb8ec9e8a
parent12e5aaa14841a7b6b8b80a1e32a2512354801f10 (diff)
Fix CBFlib detection
-rw-r--r--CMake/FindCBF.cmake13
-rw-r--r--config.h.cmake.in7
2 files changed, 19 insertions, 1 deletions
diff --git a/CMake/FindCBF.cmake b/CMake/FindCBF.cmake
index d65b0ccf..e51fd01a 100644
--- a/CMake/FindCBF.cmake
+++ b/CMake/FindCBF.cmake
@@ -10,7 +10,18 @@ if (CBF_INCLUDES)
set (CBF_FIND_QUIETLY TRUE)
endif (CBF_INCLUDES)
-find_path (CBF_INCLUDES cbf.h PATH_SUFFIXES libcbf cbf)
+find_path (CBF_CBF_INCLUDES cbf/cbf.h)
+find_path (CBFLIB_CBF_INCLUDES cbflib/cbf.h)
+
+if (NOT CBF_CBF_INCLUDES MATCHES "NOTFOUND")
+ message(STATUS "Found cbf/cbf.h in ${CBF_CBF_INCLUDES}")
+ set(CBF_INCLUDES ${CBF_CBF_INCLUDES})
+ set(HAVE_CBF_CBF_H ON)
+elseif (NOT CBFLIB_CBF_INCLUDES MATCHES "NOTFOUND")
+ message(STATUS "Found cbflib/cbf.h in ${CBFLIB_CBF_INCLUDES}")
+ set(CBF_INCLUDES ${CBFLIB_CBF_INCLUDES})
+ set(HAVE_CBFLIB_CBF_H ON)
+endif (NOT CBF_CBF_INCLUDES MATCHES "NOTFOUND")
find_library (CBF_LIBRARIES NAMES cbf)
diff --git a/config.h.cmake.in b/config.h.cmake.in
index cf124972..1188c90e 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -8,7 +8,14 @@
#cmakedefine HAVE_TIFF
#cmakedefine HAVE_XGANDALF
#cmakedefine HAVE_FDIP
+
+/* We avoid adding the full path to cbf.h, because CBFlib unhelpfully installs
+ * some conflicting HDF5 headers which we want to keep out of the include path.
+ * Unfortunately, sometimes CBFlib installs cbf/cbf.h, other times cbflib/cbf.h.
+ * These defines tell whether we have CBFlib at all, and if so, what to #include */
#cmakedefine HAVE_CBFLIB
+#cmakedefine HAVE_CBF_CBF_H
+#cmakedefine HAVE_CBFLIB_CBF_H
/* Implement us .... */
#undef HAVE_CURSES