Debian Codegraph @

cmake/modules/FindUFC.cmake

raw
1 # - Try to find UFC
2 #
3 # Once done this will define
4 #
5 # This module defines
6 #
7 # UFC_FOUND - system has UFC with correct version
8 # UFC_INCLUDE_DIRS - where to find ufc.h
9 # UFC_VERSION - UFC version
10 # UFC_SIGNATURE - UFC signature
11
12 #=============================================================================
13 # Copyright (C) 2010 Johannes Ring
14 # All rights reserved.
15 #
16 # Redistribution and use in source and binary forms, with or without
17 # modification, are permitted provided that the following conditions
18 # are met:
19 #
20 # 1. Redistributions of source code must retain the above copyright
21 # notice, this list of conditions and the following disclaimer.
22 # 2. Redistributions in binary form must reproduce the above copyright
23 # notice, this list of conditions and the following disclaimer in
24 # the documentation and/or other materials provided with the
25 # distribution.
26 #
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 # POSSIBILITY OF SUCH DAMAGE.
39 #=============================================================================
40
41 execute_process(
42 COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.backends.ufc.get_include_path())"
43 OUTPUT_VARIABLE UFC_INCLUDE_DIR
44 )
45
46 if (UFC_INCLUDE_DIR)
47 set(UFC_INCLUDE_DIRS ${UFC_INCLUDE_DIR} CACHE STRING "Where to find ufc.h")
48 mark_as_advanced(UFC_INCLUDE_DIRS)
49
50 execute_process(
51 COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.__version__)"
52 OUTPUT_VARIABLE UFC_VERSION
53 )
54 mark_as_advanced(UFC_VERSION)
55
56 if (UFC_FIND_VERSION)
57 # Check if version found is >= required version
58 if (NOT "${UFC_VERSION}" VERSION_LESS "${UFC_FIND_VERSION}")
59 set(UFC_VERSION_OK TRUE)
60 endif()
61 else()
62 # No specific version requested
63 set(UFC_VERSION_OK TRUE)
64 endif()
65 mark_as_advanced(UFC_VERSION_OK)
66
67 execute_process(
68 COMMAND ${PYTHON_EXECUTABLE} -c "import ffc, sys; sys.stdout.write(ffc.ufc_signature())"
69 OUTPUT_VARIABLE UFC_SIGNATURE
70 )
71 mark_as_advanced(UFC_SIGNATURE)
72
73 endif()
74
75 # Standard package handling
76 find_package_handle_standard_args(UFC
77 "UFC could not be found."
78 UFC_INCLUDE_DIRS
79 UFC_VERSION
80 UFC_VERSION_OK
81 UFC_SIGNATURE)