我有一只小怪兽 发表于 2020-8-4 09:14:50

linux----cmake

请问用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: *** 错误 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()

Twilight6 发表于 2020-8-4 09:19:17



看看这个能不能帮助到你:cmake编译时报错:the source directory "xxx" does not exist 怎么解决

我有一只小怪兽 发表于 2020-8-4 13:55:59

Twilight6 发表于 2020-8-4 09:19
看看这个能不能帮助到你:cmake编译时报错:the source directory "xxx" does not exist 怎么解决

不行呢

MEILL 发表于 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()
页: [1]
查看完整版本: linux----cmake