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