[CMake] add_subdirectory() twice => Policy CMP0013 is not set: Duplicate binary directories are not allowed

Paul Hansen paul.hansen.name at gmail.com
Fri Nov 4 13:39:24 EDT 2011


Hi

I have several small projects. Some of them may include another project.
I have one big project that includes all small projects.
File structure:
projects
- p1.cmake (add_subdirectory(dir_project1))
- p2.cmake (add_subdirectory(dir_project2))
- dir_project1
- dir_project2

Some of these pX.cmake may be called twice meaning that
add_subdirectory(dir_projectX) is called twice.
And the above warning appears.

Is there a way to handle this. E.g
- with guards like in C header files (tried something like that but did not
work)
- checking if the resulting library exists, if yes: don't add:subdirectory()

Just wandering if there is a defacto or smart way to handle that a
subproject may be included several times

Thanks
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111104/da2d9997/attachment.htm>


More information about the CMake mailing list