Is It possible to include sibling directory as Sub-Directory inside cmake ?
Something like
A
CMakeLists.txt
B
CMakeLists.txt
and B includes A as sub-directory ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is possible, although perhaps not recommended…
You can use the two-argument form of the add_subdirectory command to add any directory you want as a “sub” directory:
The second argument of the two-argument form specifies where to put the binary directory for the added subdirectory.
You just have to be careful that there’s not also another real sub-directory of B that is also named “A” and that is also add_subdirectory’d… Because if you do, then that would be an error, as CMake cannot have two different source directories mapping into the same build directory.