【发布时间】:2021-10-02 22:53:20
【问题描述】:
我正在使用 cmake 来尝试构建 mbedtls。我从 github 获得了 .zip,解压缩,然后我“cd”到 mbedtls 的目录中。
我收到这样的错误,无论我在哪个子目录/目录中,我都无法成功构建它。
cmake 命令:
cmake Visual Studio 10 .
CMake Error at CMakeLists.txt:172 (add_library):
Cannot find source file:
error.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at CMakeLists.txt:172 (add_library):
No SOURCES given to target: mbedcrypto
这是我所在的目录。所有的子目录/cmake 文件都在那里。我的问题是...如何在 Windows 上构建 mbedtls?
【问题讨论】:
-
then I "cd"ed into the directory of mbedtls. I get errors like these你只是从cd到目录中得到这样的错误吗?你肯定在输入cmake something something。请准确显示您输入的内容。请显示完整的cmake配置输出以及所有消息。 -
哦,是的,我忘了,@KamilCuk
-
请阅读this post了解如何调用CMake。您应该绝对不要使用 CMake 进行源内构建。
cmake .的任何变体总是错误。相反,您应该运行cmake -G "Visual Studio 16 2019" -S . -B build,然后运行cmake --build build --config Release。 (另外,您真的在使用 Visual Studio 10 吗?!升级!!)