I a CMake project, I am trying to test for availability of pthread_setname_np(). As for the headers, this function prototype only seems to be exposed if I #define _GNU_SOURCE first.
Probably for this reason, simply doing
CHECK_FUNCTION_EXISTS(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
will not detect the function even though it is present. The documentation mentions CMAKE_REQUIRED_DEFINITIONS but I am not sure how to use it (nor if it is the right way at all).
How can I get CMake to correctly detect the presence of this function?
 
    