-2
cmake_minimum_required(VERSION 3.0)

project(FireliteApp C CXX)
set (CMAKE_CXX_STANDARD 17)
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
find_package(Threads)

add_executable(FireliteApp src/dependency/Serial.cpp src/dependency/LinuxTimer.cpp src/dependency/data_type.cpp src/dependency/TASDP_COMM.cpp 
                            src/dependency/DriverAppConfig.cpp src/dependency/JSONData.cpp 
                            src/dependency/boot_data.cpp src/dependency/config_rx.cpp src/dependency/queue.c
                            src/sbus/core/SBusPkt.cpp src/sbus/core/sendsbus.cpp 
                            src/sbus/expander/expander_sbus.c src/main.cpp
               )

include_directories(include/ include/sbus/Core include/sbus/Expander include/dependency "${PROJECT_BINARY_DIR}")
target_include_directories(FireliteApp PUBLIC  include)
target_include_directories(FireliteApp PUBLIC  ../inc)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lrt -lm -g -pipe -Wall -lpthread ")

target_link_libraries(FireliteApp rt pthread )

set_property(TARGET FireliteApp PROPERTY CXX_STANDARD 17)

请帮帮我。我是 CMake 的新手

4

1 回答 1

1

错误信息

CXX_STANDARD 设置为无效值“17”

表示您尝试将CXX_STANDARD属性(或CMAKE_CXX_STANDARD变量)设置为给定 CMake版本不支持的值。

可以在该属性的文档中找到该属性的可能值列表。这样可以发现CXX_STANDARD仅在 CMake 版本 3.8 中添加了对等于 17 的支持。


由于该项目使用自 CMake 3.8 以来可用的功能,因此在cmake_minimum_required. 以适当的

cmake_minimum_required(VERSION 3.8)

尝试使用较旧的 CMake 构建项目将立即给出适当的错误。

于 2020-04-08T12:27:28.830 回答