0

I am having a lot of trouble understanding how to write CMake files. Lets just say most of the available tutorials are bad, like really bad!

So I am trying to code the assignments in a book based on each chapter and test with Google Test. I know that I must include a CMake file at each subdirectory and that I want to compile Google Test and Google Mock from a git submodule as a share module. My goal is just to have CMake run from the root and branch down to each directory compiling each subfolder without me necessarily needing to add each file but use wildcards to compile all of them.

The project structure looks similar to :

  • Root
    • CMakeLists.txt
    • README.md
    • Lessons
      • googletest (git submodule)
      • Lesson_1
        • src
          • CMakeList.txt
          • main.cpp
        • test
          • CMakeList.txt
          • test_main.cpp
        • CMakeLists.txt

How can I format the CMake file to autogenerate all these builds into a file that handles it all?

Aaron
  • 131
  • 2
  • 12
  • 1
    CMake developers say it is best to not use globbing to add sources however it can be accomplished. I still add each file one by one even on projects with 10 thousand source files. – drescherjm Jan 09 '17 at 20:42
  • 1
    Possible duplicate of [Best way to specify sourcefiles in CMake](http://stackoverflow.com/questions/1027247/best-way-to-specify-sourcefiles-in-cmake) – usr1234567 Jan 10 '17 at 06:54

0 Answers0