[CMake] adding same subdirectory multiple times.

Andreas Pakulat apaku at gmx.de
Thu Mar 11 03:04:42 EST 2010


On 11.03.10 09:56:35, Mika.Rajala at patria.fi wrote:
> 
> Hi
> 
> The problem:
> 
> >From a shared CMakeLists.txt i get the following error when defining a
> library target.
> Policy CMP0002 is not set: Logival target names must be globally unique.
> 
> 
> The situation:
> 
> Let's assume i have the following cmake files in the following folders with
> the svn:externals properties.
> 
> C:\project\CMakeLists.txt
> add_subdirectory(ProjectA)
> add_subdirectory(ProjectB)
> 
> C:\project\ProjectA   (svn:externals LibraryA <svn_path_to_libA>)
> add_subdirectory(LibraryA)
> 
> c:\project\ProjectB    (svn:externals LibraryA <svn_path_to_libA>)
> add_subdirectory(LibraryA)
> 
> c:\project\LibraryA
> add_library(LibraryA)
> 
> Thoughts:
> 
> I don't know if this causes any problem, I tried reading some
> documentations but I couldn't figure it out.

Yes it does. The library target is defined multiple times, thats not
possible. Each version of "LibraryA/CMakeLists.txt" has to use its own
name for LibraryA if you want that directory layout to work. Target
names must be globally unique as the error message says.



More information about the CMake mailing list