[CMake] "another target with the same name exists"
Bill Hoffman
bill.hoffman at kitware.com
Tue May 27 11:53:54 EDT 2008
kent williams wrote:
> Am I insane, or is CMake?
>
> In a subdirectory of our big ol build tree, CMake is freaking out
> about duplicate targets in a way that makes no sense to me:
>
> CMake Error at src/iplProg/AutoSeg/ProcessDescription/CMakeLists.txt:3
> (ADD_LIBRARY):
> add_library cannot create target "ProcessDescription" because another
> target with the same name already exists. The existing target is a static
> library created in source directory
> "/scratch/kent/brains2/src/iplProg/AutoSeg/ProcessDescription". See
> documentation for policy CMP0002 for more details.
>
> Here is the entirety of the 'offending' CMakeLists.txt:
>
> FILE (GLOB ProcessDescription_SRC *.cxx)
>
> ADD_LIBRARY(ProcessDescription ${ProcessDescription_SRC})
>
> Grepping through all the CMakeLists.txt in our source tree, that is
> the only place that library is cited as a target.
>
> Note that 'src/iplProg/AutoSeg/ProcessDescription' is the same
> directory as "/scratch/kent/brains2/src/iplProg/AutoSeg/ProcessDescription"
>
> I read the CMP0002 policy description, and I don't see how it applies
> in this particular case. CMake is acting as though it's incorrectly
> detecting a target as having been defined twice in exactly the same
> place in the same CMakeLists.txt.
> _
Is it possible that the directory is being added twice?
add_subdirectory(AutoSeg)
...
add_subdirectory(AutoSeg)
Would cause that same error.
-Bill
More information about the CMake
mailing list