c++ - CMake can't detect gcc built-in functions such as sqrt, pow ,exp and so on -


i wanna use cmake detect whether built-in functions of gcc exist. used check_function_exists command checking works. here code snippet in cmakelists.txt.

include (checkfunctionexists) set (cmake_required_includes math.h) set (cmake_required_libraries m) check_function_exists(sqrt have_sqrt) check_function_exists (pow have_pow) check_function_exists (exp have_exp) check_function_exists (log have_log) 

code snippet in tutorialconfig.h.in

// configured options , settings tutorial #define tutorial_version_major @tutorial_version_major@ #define tutorial_version_minor  @tutorial_version_minor@ #cmakedefine use_mymath #cmakedefine have_sqrt #cmakedefine have_pow #cmakedefine have_log #cmakedefine have_exp 

   however, directory when executed cmake command under source directory. got such error, weird.

-- c compiler identification gnu 7.0.0 -- cxx compiler identification gnu 7.0.0 -- check working c compiler: /usr/bin/cc -- check working c compiler: /usr/bin/cc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- detecting c compile features -- detecting c compile features - done -- check working cxx compiler: /usr/bin/c++ -- check working cxx compiler: /usr/bin/c++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done -- detecting cxx compile features -- detecting cxx compile features - done -- looking sqrt cmake error: source directory "../build/cmakefiles/cmaketmp" not exist. specify --help usage, or press button on cmake gui. cmake error @ /usr/share/cmake/modules/checkfunctionexists.cmake:70 (try_compile):   failed configure test project build system. call stack (most recent call first):   cmakelists.txt:23 (check_function_exists) 

   however, directory claimed in error message indeed exists.

$ ls -la ../build/cmakefiles/cmaketmp    total 0   drwxrwxrwx 1 root root 0 apr 14 21:41 .   drwxrwxrwx 1 root root 0 apr 14 20:32 .. 

   not expert in cmake, can't figure out crux.

   here my log file outputed cmake

hope familiar cmake gives me hand. in advance.

error message

cmake error: source directory "../build/cmakefiles/cmaketmp" not exist. 

is possible if relative path used build directory.

while not explicitely stated in docs (and not checked cmake itself), better use absolute path build directory.


because build directory of cmake project isn't designed moved other place (or on other machine), there no reason using relative path it.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -