I have a CMake macro that calls check_function_exists() to detect several math functions.
By the output below, it seems that check_function_exists() is only called the first time;
macro(nco_check_funcs func def)
message(${ARGV0})
check_function_exists(${ARGV0} have_result)
message(${have_result})
if (NOT have_result)
message("-- Using NCO defined version of ${ARGV0}")
add_definitions(-D${ARGV1})
endif()
endmacro(nco_check_funcs)
nco_check_funcs(atan2 NEED_ATAN2)
nco_check_funcs(acosf NEED_ACOSF)
nco_check_funcs(asinf NEED_ASINF)
in the example below the macro is called 3 times, but the output of check_function_exists() only shows up 1 time
atan2
-- Looking for atan2
-- Looking for atan2 - found
1
acosf
1
asinf
1