-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)

Please help me out. I'm new to CMake

Kevin
  • 16,549
  • 8
  • 60
  • 74
  • 1
    Welcome to Stack Overflow! Please post the **error messages** you are seeing in your question post as text, not only in the title. – Kevin Apr 08 '20 at 12:03

1 Answers1

1

Error message

CXX_STANDARD is set to invalid value '17'

means that you attempt to set CXX_STANDARD property (or CMAKE_CXX_STANDARD variable) to the value, which is not supported in the given CMake version.

List of possible values for the property can be found in the documentation for the property. Such way it could be found that support for CXX_STANDARD equal 17 has been added only in CMake version 3.8.


Since the project uses a feature available since CMake 3.8, it has a little sense to specify lesser version in cmake_minimum_required. With proper

cmake_minimum_required(VERSION 3.8)

attempt to build the project with older CMake will immediately give an appropriate error.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • what about add_executable error which i see.. in this Cmake – MANOJ GAIKWAD Apr 08 '20 at 12:56
  • Such a way CMake points to the line which creates an executable with invalid property. – Tsyvarev Apr 08 '20 at 13:09
  • And what about following the [comment to your question post](https://stackoverflow.com/questions/61100174/cmake-error-add-executable-i-am-not-getting-what-eerror-it-is-also-i-get-cxx/61100656?noredirect=1#comment108093973_61100174) and adding the **exact error message** into the question's body? Such a way the error message could be correctly formatted and easily seen by other readers. Not to say that fix would help you with downvotes... – Tsyvarev Apr 08 '20 at 13:10