1 include(CheckCSourceCompiles)
3 macro(check_const_exists CONST FILES VARIABLE)
4 if (NOT DEFINED ${VARIABLE})
5 set(check_const_exists_source "")
7 set(check_const_exists_source
8 "${check_const_exists_source}
11 set(check_const_exists_source
12 "${check_const_exists_source}
13 int main() { (void)${CONST}; return 0; }")
15 check_c_source_compiles("${check_const_exists_source}" ${VARIABLE})
18 set(${VARIABLE} 1 CACHE INTERNAL "Have const ${CONST}")
19 message(STATUS "Looking for ${CONST} - found")
21 set(${VARIABLE} 0 CACHE INTERNAL "Have const ${CONST}")
22 message(STATUS "Looking for ${CONST} - not found")
25 endmacro(check_const_exists)