简体   繁体   English

如何制作一个只有一个 cpp 文件和两个.h 文件的 CMakeLists?

[英]How do I make a CMakeLists with only one cpp file and two .h files?

I have a file called proj10.cpp and two different.h files which are in a include folder and the.cpp file is in the src folder.我有一个名为 proj10.cpp 的文件和两个不同的.h 文件,它们位于包含文件夹中,而 .cpp 文件位于 src 文件夹中。 I have no idea how to make the CMake file since the other ones ive done have had multiple.cpp files.我不知道如何制作 CMake 文件,因为我做过的其他文件有多个.cpp 文件。

I don't know where the problem is, but anyway, you could try this:我不知道问题出在哪里,但无论如何,你可以试试这个:

cmake_minimum_required (VERSION 3.7)
project (proj10)

add_executable(${CMAKE_PROJECT_NAME} src/proj10.c)
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC include)

for the next time, it would easier for us, if you show us what you've coded so far.下一次,如果您向我们展示您迄今为止编码的内容,对我们来说会更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM