C++ 如何在Qt Creator中的CMakeLists.txt中包含头文件?
此文件不是任何项目的一部分 我知道它一定是CMakeLists.txt的内容,但我不知道如何做,或者为什么它没有自动包含C++ 如何在Qt Creator中的CMakeLists.txt中包含头文件?,c++,qt,cmake,C++,Qt,Cmake,此文件不是任何项目的一部分 我知道它一定是CMakeLists.txt的内容,但我不知道如何做,或者为什么它没有自动包含 cmake_minimum_required(VERSION 2.8) project(S13V140_implementing_member_method) add_executable(${PROJECT_NAME} "main.cpp") ??? 以下CMakeLists.txt应适用于您: cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8)
project(S13V140_implementing_member_method)
add_executable(${PROJECT_NAME} "main.cpp")
???
以下CMakeLists.txt应适用于您:
cmake_minimum_required(VERSION 2.8)
# define the project name
project(S13V140_implementing_member_method)
# find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# C++11 support - else we run into issues with the non-static nullptr-assignment
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# put all sources into one variable: no distinction between h, cpp and ui (or qrc)
set(SOURCES
main.cpp
)
# create the final result
add_executable(S13V140_implementing_member_method ${SOURCES})
要使CMake和Qt协同工作,请确保将所有头文件添加到源文件列表中
set(sources "main.cpp" "my_header.h")
add_executable(${PROJECT_NAME} ${sources})