开发者

How do I merge subdirectories into a single executable?

I understand that every subdirect开发者_如何学Pythonory has to have a CMakeLists.txt, but I don't want to create a library or an executable for each directory.

My folder structure:

/src
  /exportedHeaders
  /server
  main.cpp

Each subfolder has a mix of .h and .cpp files. I don't understand how I can mix all of it up into a single executable, there doesn't seem to be a command for that.


I haven't really used CMake, so there is probably a better way, but as far as I know you can just specify the path to all the source files.

eg:

add_executable (myProgram main.cpp subdir1/foo.cpp subdir2/bla.cpp) 

I imagine you could use file globbing to get *.cpp in each subdir, to reduce typing. See this mailing list message for info about file globbing in CMake.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜