cmake-boun...@cmake.org wrote on 11.03.2010 10:04:42:
> On 11.03.10 09:56:35, mika.raj...@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. > > From a quick glance I see two options: > - drop the externals and let the projects depend on a "LibraryA" target > being defined (you need to use the add_subdirectory call for it to the > fron then > - find a way to test in LibraryA/CMakeLists.txt wether its under > ProjectA, ProjectB or project and adjust the target name then. > > Andreas > > -- > Questionable day. > > Ask somebody something. > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at http://www.kitware. > com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: http://www. > cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake Thanks. I'd still like to know if there is a way to handle this like including c++ header files Something like if(LibraryA) message(Already included, doing nothing) else() <Normal CMakeLists content> endif() -mika _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake