1 # Copyright Raimar Sandner 2012–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
4 #! \ingroup FindPackage
5 #! \brief Find blitz++.
7 #! Once done, this will define
9 #! - `blitz_FOUND`: system has blitz
10 #! - `blitz_INCLUDE_DIRS`: the blitz include directories
11 #! - `blitz_LIBRARIES`: link these to use blitz
12 #! - `blitz_SERIALIZATION_FOUND`: true if blitz was configured with `--enable-serialization`
14 #! Not that blitz will only be considered found if it is the [C++QED patched version](http://sourceforge.net/p/cppqed/blitz/ci/default/tree/).
15 #! This is checked by looking if it has `BLITZ_ARRAY_LARGEST_RANK`.
17 include(LibFindMacros)
18 include(CheckIncludeFiles)
19 include(CheckSymbolExists)
22 find_package(PkgConfig QUIET)
23 pkg_check_modules(blitz_PKGCONF QUIET blitz)
27 find_path(blitz_INCLUDE_DIR
28 NAMES blitz/tinyvec2.h
29 HINTS ${blitz_PKGCONF_INCLUDE_DIRS}
32 # Finally the library itself
33 find_library(blitz_LIBRARY
35 HINTS ${blitz_PKGCONF_LIBRARY_DIRS}
38 # Set the include dir variables and the libraries and let libfind_process do the rest.
39 # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
40 set(blitz_PROCESS_INCLUDES blitz_INCLUDE_DIR)
41 set(blitz_PROCESS_LIBS blitz_LIBRARY)
42 libfind_process(blitz)
44 file(READ ${blitz_INCLUDE_DIR}/blitz/blitz.h BLITZ_H)
45 string(REGEX MATCH BLITZ_ARRAY_LARGEST_RANK blitz_IS_CPPQED_VERSION ${BLITZ_H})
46 if(NOT blitz_IS_CPPQED_VERSION)
47 message(FATAL_ERROR "You need the C++QED version of blitz++. The repository is at http://sourceforge.net/p/cppqed/blitz/ci/default/tree/")
48 endif(NOT blitz_IS_CPPQED_VERSION)
50 file(GLOB BZCONFIG ${blitz_INCLUDE_DIR}/blitz/*/bzconfig.h)
51 CHECK_SYMBOL_EXISTS(BZ_HAVE_BOOST_SERIALIZATION ${BZCONFIG} blitz_SERIALIZATION_FOUND)