Assuming the following configuration :
parentdir1/parentdir2/myproject
parentdir1/parentdir2/myproject/CMakeLists.txt
parentdir1/parentdir2/开发者_StackOverflowmyproject/src
parentdir1/parentdir2/myproject/src/dir1
parentdir1/parentdir2/myproject/src/dir2
parentdir1/parentdir2/myproject/src/dir3
Currently, my CMakeLists produces only one Makefile in parentdir1/parentdir2/myproject
.
How to produce a Makefile in each subdirectory (to compile the associated directory) ?
Thank you very much.
CMake allows you to have a CMakeLists.txt file in any subdirectory under the root directory of your source tree.
Then use the add_subdirectory command in CMakeLists.txt to add the subdirectories. Then CMake will look for CMakeLists.txt in those subdirectories.
See the documentation for the add_subdirectory command here:
http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_subdirectory
For more info, check out the CMake FAQ and documentation on www.cmake.org.
精彩评论