cmake 编译出现错误 Could NOT find Threads (missing: Threads_FOUND)

1. 出现的错误如下

Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.10/Modules/FindThreads.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:55 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/qhq/mt7621_5g_mec/OTA-hw v1.0.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/qhq/mt7621_5g_mec/OTA-hw v1.0.0/build/CMakeFiles/CMakeError.log".

 

2. 说法是

CMake使用短的“C”应用程序来测试/尝试某些东西。如果CMakeLists.txt文件声明C++用于项目,而不列出C,
那么一些短裤测试错误地失败,CFAG则认为这些东西没有找到。

3. 修改方案是 PROJECT ( Test CXX ) 修改为 PROJECT ( Test C CXX ),修改完之后cmake 指令通过

 

4. 然后编译 make CC=/home/qhq/toolchain-mipsel-gcc-8.3.0/bin/mipsel-openwrt-linux-gcc

修改完编译之后报错

mipsel-openwrt-linux-gcc: error: unrecognized command line option '-m32'
mipsel-openwrt-linux-gcc: error: unrecognized command line option '-m32'

 

5. 修改文件CMakeLists.txt 文件,如下图

 

6. 问题解决,编译通过

 

 

 

 

posted @ 2020-09-21 14:55  429512065  阅读(8938)  评论(0编辑  收藏  举报