1*657871a7Schristosinclude(CheckSymbolExists) 2*657871a7Schristosinclude(CheckIncludeFiles) 3*657871a7Schristos 4*657871a7Schristos# Check if each symbol in the symbol list exists, 5*657871a7Schristos# and define PREFIX__HAVE_SYMNAME to 1 if yes. 6*657871a7Schristos# 7*657871a7Schristos# SYMLIST: list of symbols to check 8*657871a7Schristos# HEADERS: header files to be included in check code 9*657871a7Schristos# PREFIX: the prefix of definition 10*657871a7Schristosmacro(CHECK_SYMBOLS_EXIST SYMLIST HEADERS PREFIX) 11*657871a7Schristos foreach(SYMNAME ${SYMLIST}) 12*657871a7Schristos string(TOUPPER "${SYMNAME}" SYMNAME_UPPER) 13*657871a7Schristos if ("${PREFIX}" STREQUAL "") 14*657871a7Schristos set(HAVE_SYM_DEF "HAVE_${SYMNAME_UPPER}") 15*657871a7Schristos else() 16*657871a7Schristos set(HAVE_SYM_DEF "${PREFIX}__HAVE_${SYMNAME_UPPER}") 17*657871a7Schristos endif() 18*657871a7Schristos CHECK_SYMBOL_EXISTS(${SYMNAME} "${HEADERS}" ${HAVE_SYM_DEF}) 19*657871a7Schristos endforeach() 20*657871a7Schristosendmacro() 21*657871a7Schristos 22*657871a7Schristos# Check if file exists, define PREFIX__HAVE_FILE to 1 if yes, 23*657871a7Schristos# and collect file to EVENT_INCLUDES 24*657871a7Schristosmacro(CHECK_INCLUDE_FILE_CONCAT FILE PREFIX) 25*657871a7Schristos string(REGEX REPLACE "[./]" "_" FILE_UL ${FILE}) 26*657871a7Schristos string(TOUPPER "${FILE_UL}" FILE_UL_UPPER) 27*657871a7Schristos if ("${PREFIX}" STREQUAL "") 28*657871a7Schristos set(HAVE_FILE_DEF "HAVE_${FILE_UL_UPPER}") 29*657871a7Schristos else() 30*657871a7Schristos set(HAVE_FILE_DEF "${PREFIX}__HAVE_${FILE_UL_UPPER}") 31*657871a7Schristos endif() 32*657871a7Schristos CHECK_INCLUDE_FILES("${EVENT_INCLUDES};${FILE}" ${HAVE_FILE_DEF}) 33*657871a7Schristos if(${HAVE_FILE_DEF}) 34*657871a7Schristos set(EVENT_INCLUDES ${EVENT_INCLUDES} ${FILE}) 35*657871a7Schristos endif() 36*657871a7Schristosendmacro() 37