How to organize project structure?

I'm new to CMake.
What I'm doing in CMakeLists.txt is:


project(myprj)
include_directories(/my/project/include/)
file(glob_recurse SOURCE_FILES
    /my/project/src/*.cc
    /my/project/src/*.h)

add_executable(myprj ${SOURCE_FILES})


And when I open this file with CLion, all my cc files and h files are in the same level directly under project.

How can I make it organized by directories?

Thank you!

Leo

1 comment
Comment actions Permalink

It seems that it's because my CMakeLists.txt is not in the /my/project folder.
When I put it in /my/project everything works fine.

Now my question becomes:
Can I specify my project root without putting CMakeLists.txt in my project?
My company doesn't use CMake, and I don't want to put unrelated files in my source code repository.

Thank you!

Leo

0

Please sign in to leave a comment.