[CMake] CheckSymbolExists fails with multiple header files

Leif Walsh leif.walsh at gmail.com
Fri May 11 13:32:55 EDT 2012


I want to check whether M_MMAP_THRESHOLD is defined in either malloc.h or sys/malloc.h, and whether CLOCK_REALTIME is defined in either time.h or sys/time.h.  I thought this would work:

check_symbol_exists(M_MMAP_THRESHOLD "malloc.h;sys/malloc.h" HAVE_M_MMAP_THRESHOLD)
check_symbol_exists(CLOCK_REALTIME "time.h;sys/time.h" HAVE_CLOCK_REALTIME)

In this case, I found CLOCK_REALTIME but not M_MMAP_THRESHOLD (they both exist on this system, btw).

Here are some things I've tried and their outcomes:

for M_MMAP_THRESHOLD:
"malloc.h;sys/malloc.h" -> not found
"malloc.h" -> found
"stdlib.h;malloc.h;sys/malloc.h" -> not found

and for CLOCK_REALTIME:
"time.h" -> found
"sys/time.h" (which includes <time.h> in fact) -> not found
"time.h;sys/time.h" -> found

This leads me to believe that something funky is going on with this module.  Perhaps there is a bug?

-- 
Cheers,
Leif



More information about the CMake mailing list