鱼C论坛

 找回密码
 立即注册
查看: 2193|回复: 3

linux----cmake

[复制链接]
发表于 2020-8-4 09:14:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
请问用cmake编译出现下面的情况怎么回事呢,有大佬知道的么?

CMake Error at platform/linux/CMakeLists.txt:3 (get_filename_component):
  get_filename_component unknown component DIRECTORY


CMake Error at platform/linux/CMakeLists.txt:5 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "mqtt"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "platform"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "network"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "common"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "salof"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "mbedtls"

  Unknown arguments specified


CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "mqttclient"

  Unknown arguments specified


CMake Error at common/log/arch/linux/CMakeLists.txt:3 (get_filename_component):
  get_filename_component unknown component DIRECTORY


CMake Error at common/log/arch/linux/CMakeLists.txt:5 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.


-- Configuring incomplete, errors occurred!
CMake Error: The source directory "" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** [cmake_check_build_system] 错误 1

下面是我的cmakelist.txt文件

aux_source_directory(. DIR_SRCS)

get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)

string(REGEX REPLACE ".*/(.*)" "\\1" LIB_NAME ${PARENT_DIR})

if (DIR_SRCS)
    foreach(libname ${LIBNAMES})
        if (${LIB_NAME} STREQUAL ${libname})
            add_library(${libname} ${CMAKE_LIB_TYPE} ${DIR_SRCS})
        endif()
    endforeach()

else()
    message(WARNING "not find is src file!")
endif()

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-4 09:19:17 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-8-4 13:55:59 | 显示全部楼层
Twilight6 发表于 2020-8-4 09:19
看看这个能不能帮助到你:cmake编译时报错:the source directory "xxx" does not exist 怎么解决

不行呢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2024-3-2 21:54:38 | 显示全部楼层
CMake Warning at platform/linux/CMakeLists.txt:9 (if):
  given arguments:

    "STREQUAL" "network"

应该是你前面的变量用了 ${xxx} 去引用, cmake if语句 判断需要用引用
ex
set(MY_VAR abc)
if(MY_VAR STREQUAL abc)
message(FATAL_ERROR "I am in here")
endif()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-22 11:34

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表