Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ CMake check_函数不存在';T_C++_Cmake - Fatal编程技术网

C++ CMake check_函数不存在';T

C++ CMake check_函数不存在';T,c++,cmake,C++,Cmake,我正在与相关人员进行沟通和交叉检查,我被困在第4步 本说明将这些行添加到顶级CMakeLists.txt文件中: # does this system provide the log and exp functions? include (CheckFunctionExists) check_function_exists (log HAVE_LOG) check_function_exists (exp HAVE_EXP) 如前所述,这是一个微不足道的测试,因为地球上几乎每个系统都有log和

我正在与相关人员进行沟通和交叉检查,我被困在第4步

本说明将这些行添加到顶级CMakeLists.txt文件中:

# does this system provide the log and exp functions?
include (CheckFunctionExists)
check_function_exists (log HAVE_LOG)
check_function_exists (exp HAVE_EXP)
如前所述,这是一个微不足道的测试,因为地球上几乎每个系统都有
log
exp
。但它失败了。生成makefile时,我看到

-- Looking for log
-- Looking for log - not found
-- Looking for exp
-- Looking for exp - not found
如果我深入挖掘,运行
cmake--trace
,我会看到以下几行:

.../tutorial/src/CMakeLists.txt(19):  include( CheckFunctionExists )
/usr/share/cmake/Modules/CheckFunctionExists.cmake(32):  macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE )
.../tutorial/src/CMakeLists.txt(20):  check_function_exists(log HAVE_LOG )
/usr/share/cmake/Modules/CheckFunctionExists.cmake(33):  if(HAVE_LOG MATCHES ^HAVE_LOG$ )
.../tutorial/src/CMakeLists.txt(21):  check_function_exists(exp HAVE_EXP )
/usr/share/cmake/Modules/CheckFunctionExists.cmake(33):  if(HAVE_EXP MATCHES ^HAVE_EXP$ )
CheckFunctionExists.cmake
文件中,该测试没有
else
条件。我不熟悉cmake,但这些测试在我看来是真实的。我错过了什么


CentOS 7、cmake 2.8.12.2

检查功能存在
已知存在严重缺陷。看

在你的情况下,你可能会遇到第一个陷阱。函数
log
exp
在许多平台上都是内在的内联函数。在链接时无法检测到它们


建议的更换方法是
检查SYMBOLEXISTS
。不幸的是,您的cmake版本不支持这一点。您需要至少升级到3.0.2才能正常工作。

有关CheckSymbolExists的文档很少。你能提供一个有效的例子吗?跌跌撞撞地说,这似乎是可行的:`include(CheckCXXSymbolExists)check_cxx_symbol_exists(log cmath HAVE_log)`