Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindGBM.cmake
- This file was copied from cmake/modules/Findgbm.cmake.
1 | #.rst: | 1 | #.rst: | ||
---|---|---|---|---|---|
2 | # Findgbm | 2 | # FindGBM | ||
3 | # ------- | 3 | # ------- | ||
4 | # | 4 | # | ||
5 | # Try to find gbm on a Unix system. | 5 | # Try to find gbm on a Unix system. | ||
6 | # | 6 | # | ||
7 | # This will define the following variables: | 7 | # This will define the following variables: | ||
8 | # | 8 | # | ||
9 | # ``gbm_FOUND`` | 9 | # ``GBM_FOUND`` | ||
10 | # True if (the requested version of) gbm is available | 10 | # True if (the requested version of) gbm is available | ||
11 | # ``gbm_VERSION`` | 11 | # ``GBM_VERSION`` | ||
12 | # The version of gbm | 12 | # The version of gbm | ||
13 | # ``gbm_LIBRARIES`` | 13 | # ``GBM_LIBRARIES`` | ||
14 | # This can be passed to target_link_libraries() instead of the ``gbm::gbm`` | 14 | # This can be passed to target_link_libraries() instead of the ``GBM::GBM`` | ||
15 | # target | 15 | # target | ||
16 | # ``gbm_INCLUDE_DIRS`` | 16 | # ``GBM_INCLUDE_DIRSS`` | ||
17 | # This should be passed to target_include_directories() if the target is not | 17 | # This should be passed to target_include_directories() if the target is not | ||
18 | # used for linking | 18 | # used for linking | ||
19 | # ``gbm_DEFINITIONS`` | 19 | # ``GBM_DEFINITIONS`` | ||
20 | # This should be passed to target_compile_options() if the target is not | 20 | # This should be passed to target_compile_options() if the target is not | ||
21 | # used for linking | 21 | # used for linking | ||
22 | # | 22 | # | ||
23 | # If ``gbm_FOUND`` is TRUE, it will also define the following imported target: | 23 | # If ``GBM_FOUND`` is TRUE, it will also define the following imported target: | ||
24 | # | 24 | # | ||
25 | # ``gbm::gbm`` | 25 | # ``GBM::GBM`` | ||
26 | # The gbm library | 26 | # The gbm library | ||
27 | # | 27 | # | ||
28 | # In general we recommend using the imported target, as it is easier to use. | 28 | # In general we recommend using the imported target, as it is easier to use. | ||
29 | # Bear in mind, however, that if the target is in the link interface of an | 29 | # Bear in mind, however, that if the target is in the link interface of an | ||
30 | # exported library, it must be made available by the package config file. | 30 | # exported library, it must be made available by the package config file. | ||
31 | 31 | | |||
32 | #============================================================================= | 32 | #============================================================================= | ||
33 | # Copyright 2014 Alex Merry <alex.merry@kde.org> | 33 | # Copyright 2014 Alex Merry <alex.merry@kde.org> | ||
Show All 18 Lines | |||||
52 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 52 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
53 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 53 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
54 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 54 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
55 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 55 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
56 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 56 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
57 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 57 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
58 | #============================================================================= | 58 | #============================================================================= | ||
59 | 59 | | |||
60 | if(CMAKE_VERSION VERSION_LESS 2.8.12) | | |||
61 | message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake") | | |||
62 | endif() | | |||
63 | if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) | | |||
64 | message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake") | | |||
65 | endif() | | |||
66 | | ||||
67 | if(NOT WIN32) | | |||
68 | # Use pkg-config to get the directories and then use these values | 60 | # Use pkg-config to get the directories and then use these values | ||
69 | # in the FIND_PATH() and FIND_LIBRARY() calls | 61 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||
70 | find_package(PkgConfig) | 62 | find_package(PkgConfig) | ||
71 | pkg_check_modules(PKG_gbm QUIET gbm) | 63 | pkg_check_modules(PKG_GBM QUIET gbm) | ||
72 | 64 | | |||
73 | set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) | 65 | set(GBM_DEFINITIONS ${PKG_GBM_CFLAGS_OTHER}) | ||
74 | set(gbm_VERSION ${PKG_gbm_VERSION}) | 66 | set(GBM_VERSION ${PKG_GBM_VERSION}) | ||
75 | 67 | | |||
76 | find_path(gbm_INCLUDE_DIR | 68 | find_path(GBM_INCLUDE_DIRS | ||
77 | NAMES | 69 | NAMES | ||
78 | gbm.h | 70 | gbm.h | ||
79 | HINTS | 71 | HINTS | ||
80 | ${PKG_gbm_INCLUDE_DIRS} | 72 | ${PKG_GBM_INCLUDE_DIRS} | ||
81 | ) | 73 | ) | ||
82 | find_library(gbm_LIBRARY | 74 | find_library(GBM_LIBRARIES | ||
83 | NAMES | 75 | NAMES | ||
84 | gbm | 76 | gbm | ||
85 | HINTS | 77 | HINTS | ||
86 | ${PKG_gbm_LIBRARY_DIRS} | 78 | ${PKG_GBM_LIBRARIES_DIRS} | ||
87 | ) | 79 | ) | ||
88 | 80 | | |||
89 | include(FindPackageHandleStandardArgs) | 81 | include(FindPackageHandleStandardArgs) | ||
90 | find_package_handle_standard_args(gbm | 82 | find_package_handle_standard_args(GBM | ||
91 | FOUND_VAR | 83 | FOUND_VAR | ||
92 | gbm_FOUND | 84 | GBM_FOUND | ||
93 | REQUIRED_VARS | 85 | REQUIRED_VARS | ||
94 | gbm_LIBRARY | 86 | GBM_LIBRARIES | ||
95 | gbm_INCLUDE_DIR | 87 | GBM_INCLUDE_DIRS | ||
96 | VERSION_VAR | 88 | VERSION_VAR | ||
97 | gbm_VERSION | 89 | GBM_VERSION | ||
98 | ) | 90 | ) | ||
99 | 91 | | |||
100 | if(gbm_FOUND AND NOT TARGET gbm::gbm) | 92 | if(GBM_FOUND AND NOT TARGET GBM::GBM) | ||
101 | add_library(gbm::gbm UNKNOWN IMPORTED) | 93 | add_library(GBM::GBM UNKNOWN IMPORTED) | ||
102 | set_target_properties(gbm::gbm PROPERTIES | 94 | set_target_properties(GBM::GBM PROPERTIES | ||
103 | IMPORTED_LOCATION "${gbm_LIBRARY}" | 95 | IMPORTED_LOCATION "${GBM_LIBRARIES}" | ||
104 | INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" | 96 | INTERFACE_COMPILE_OPTIONS "${GBM_DEFINITIONS}" | ||
105 | INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" | 97 | INTERFACE_INCLUDE_DIRECTORIES "${GBM_INCLUDE_DIRS}" | ||
106 | ) | 98 | ) | ||
107 | endif() | 99 | endif() | ||
108 | 100 | | |||
109 | mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) | 101 | mark_as_advanced(GBM_LIBRARIES GBM_INCLUDE_DIRS) | ||
110 | | ||||
111 | # compatibility variables | | |||
112 | set(gbm_LIBRARIES ${gbm_LIBRARY}) | | |||
113 | set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR}) | | |||
114 | set(gbm_VERSION_STRING ${gbm_VERSION}) | | |||
115 | | ||||
116 | else() | | |||
117 | message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.") | | |||
118 | set(gbm_FOUND FALSE) | | |||
119 | endif() | | |||
120 | 102 | | |||
121 | include(FeatureSummary) | 103 | include(FeatureSummary) | ||
122 | set_package_properties(gbm PROPERTIES | 104 | set_package_properties(GBM PROPERTIES | ||
123 | URL "http://www.mesa3d.org" | 105 | URL "http://www.mesa3d.org" | ||
124 | DESCRIPTION "Mesa gbm library." | 106 | DESCRIPTION "Mesa gbm library." | ||
125 | ) | 107 | ) |