[CMake] CheckCSourceCompiles (revisited)

Marcel Loose loose at astron.nl
Fri Mar 6 08:50:50 EST 2009


Hi all,

With respect to my previous post.
Is it possible to somehow reset the result variable from
CheckCSourceCompiles(SOURCE VAR)?

I wanted to run a number of tests in a foreach loop, using the same
C-code snippet, but with one CMake variable being substituted, but I
noticed that the test is run only once. Is there a way to reuse/reset
the cache variable "result", or should I make the result variable
unique, e.g. HAVE_${func_name}?

foreach(func_name __PRETTY_FUNCTION__ __FUNCTION__)
  check_c_source_compiles("
    #include <stdio.h>
    int main() { puts(${func_name}); }
    " result)
# if(result)
#   break()
# endif(result)
endforeach(func_name __PRETTY_FUNCTION__ __FUNCTION__)




More information about the CMake mailing list