[CMake] include_external_msproject creating duplicate projects in parent solution

Tyler Roscoe tyler at cryptio.net
Fri Jun 5 12:21:37 EDT 2009


On Thu, Jun 04, 2009 at 12:47:48PM -0500, Randy Hancock wrote:
> external msproject to the parent. This is desirable, but lets say both
> the test/time project and the test/string project include the common
> lib. This makes common show up *twice* in the parent solution and
> causes a bunch of unwanted errors in visual studio.
> 
> Does anyone know of a good workaround for this? It would be nice if

I don't use include_external_msproject but I have a similar problem with
CMakeLists that both add_subdirectory() a common list file.

What I do is provide a re-entry guard, much like C headers often do:

if (NOT TARGET ${PROJECT_NAME})
    ...
    <body of CMakeLists>
    ...
endif (NOT TARGET ${PROJECT_NAME})


Looks like you can use INCLUDE_EXTERNAL_MSPROJECT_[projectname] to get
the same effect.

tyler


More information about the CMake mailing list