996
|
1 # - Check if a given library exists and have a specific function.
|
|
2 # CFUNGE_CHECK_LIBRARY_FUNCTION(_target _library _function _location)
|
|
3 #
|
|
4 # _target - Build target to add the library for to link.
|
|
5 # _library - Library to check for and then check for function in.
|
|
6 # _function - Function name to check for.
|
|
7 # _location - Location where the library should be found.
|
|
8 #
|
|
9 # The same variables as for CheckLibraryExists affect this macro.
|
|
10 #
|
|
11 # Will set CFUNGE_CHECKLIBFUNC_<library>_<function> (as CheckLibraryExists out variable).
|
|
12 # Will #define HAVE_<function> if found.
|
|
13 # Will set the variable CFUNGE_HAVE_<library>_<function> if found.
|
|
14 # Will add the library to target_link_libraries() if found.
|
|
15 #
|
|
16
|
|
17 # cfunge - A standard-conforming Befunge93/98/109 interpreter in C.
|
|
18 # Copyright (C) 2008 Arvid Norlander <anmaster AT tele2 DOT se>
|
|
19 #
|
|
20 # This program is free software: you can redistribute it and/or modify
|
|
21 # it under the terms of the GNU General Public License as published by
|
|
22 # the Free Software Foundation, either version 3 of the License, or
|
|
23 # (at the proxy's option) any later version. Arvid Norlander is a
|
|
24 # proxy who can decide which future versions of the GNU General Public
|
|
25 # License can be used.
|
|
26 #
|
|
27 # This program is distributed in the hope that it will be useful,
|
|
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
30 # GNU General Public License for more details.
|
|
31 #
|
|
32 # You should have received a copy of the GNU General Public License
|
|
33 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
34
|
|
35 include(CheckLibraryExists)
|
|
36
|
|
37 macro(CFUNGE_CHECK_LIBRARY_FUNCTION _target _library _function _location)
|
|
38 CHECK_LIBRARY_EXISTS(${_library} ${_function} ${_location} CFUNGE_CHECKLIBFUNC_${_library}_${_function})
|
|
39 if (CFUNGE_CHECKLIBFUNC_${_library}_${_function})
|
|
40 set(CFUNGE_HAVE_${_library}_${_function} true PARENT_SCOPE)
|
|
41 add_definitions(-DHAVE_${_function})
|
|
42 target_link_libraries(${_target} ${_library})
|
|
43 endif (CFUNGE_CHECKLIBFUNC_${_library}_${_function})
|
|
44 endmacro(CFUNGE_CHECK_LIBRARY_FUNCTION)
|