CMake check_function_exists only called one time in macro -
i have cmake macro calls check_function_exists() detect several math functions.
by output below, seems check_function_exists() called 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 example below macro called 3 times, output of check_function_exists() shows 1 time
atan2 -- looking atan2 -- looking atan2 - found 1 acosf 1 asinf 1
those results of check_function_exists()
cached.
check
<function>
provided libraries on system , store result in<variable>
.<variable>
created as internal cache variable.
add following begin of macro:
unset(have_result cache)
or if want keep functionality of searching ones function (and cache result), need variable name depend on function this:
check_function_exists(${argv0} have_result_${argv0})
now each search function has own result variable.
reference
Comments
Post a Comment