996
|
1 # - Check if the Linker supports a specific flag and if yes add it.
|
|
2 # CFUNGE_CHECK_LINKER_FLAG(_target _name _flag)
|
|
3 #
|
|
4 # _target - Target to add to.
|
|
5 # _name - Name to use for cache variable.
|
|
6 # _flag - Flag to check for
|
|
7 #
|
|
8 # The same variables as for CheckCSourceCompiles affect this macro.
|
|
9 # Exception: SAFE_CMAKE_REQUIRED_FLAGS is overridden.
|
|
10 #
|
|
11 # Will set CFUNGE_CHECKLINKERFLAG_$<name> (as CheckCCompilerFlag out variable).
|
|
12 # Will use MACRO_ADD_LINK_FLAGS() to add the <flag> if supported.
|
|
13 #
|
|
14
|
|
15 # cfunge - A standard-conforming Befunge93/98/109 interpreter in C.
|
|
16 # Copyright (C) 2008 Arvid Norlander <anmaster AT tele2 DOT se>
|
|
17 #
|
|
18 # This program is free software: you can redistribute it and/or modify
|
|
19 # it under the terms of the GNU General Public License as published by
|
|
20 # the Free Software Foundation, either version 3 of the License, or
|
|
21 # (at the proxy's option) any later version. Arvid Norlander is a
|
|
22 # proxy who can decide which future versions of the GNU General Public
|
|
23 # License can be used.
|
|
24 #
|
|
25 # This program is distributed in the hope that it will be useful,
|
|
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28 # GNU General Public License for more details.
|
|
29 #
|
|
30 # You should have received a copy of the GNU General Public License
|
|
31 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
|
33 include(CheckCSourceCompiles)
|
|
34 include(MacroAddLinkFlags)
|
|
35
|
|
36 macro(CFUNGE_CHECK_LINKER_FLAG _target _name _flag)
|
|
37 SET(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
|
38 SET(CMAKE_REQUIRED_FLAGS "${_flag}")
|
|
39 CHECK_C_SOURCE_COMPILES("int main() { return 0;}" CFUNGE_CHECKLINKERFLAG_${_name})
|
|
40 if (CFUNGE_CHECKLINKERFLAG_${_name})
|
|
41 MACRO_ADD_LINK_FLAGS(${_target} ${_flag})
|
|
42 endif (CFUNGE_CHECKLINKERFLAG_${_name})
|
|
43 SET(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
|
44 endmacro(CFUNGE_CHECK_LINKER_FLAG)
|