[CMake] Support for multiple targets with the same name
Filipe Sousa
filipe at ipb.pt
Tue Jun 14 15:41:07 EDT 2005
On Tuesday 14 June 2005 20:27, Ken Martin wrote:
> I'm implementing support for having an executable and library with the same
> name. A few projects do this and currently CMake does not support it. There
> is a design question to address in how CMake should work with two targets
> with the same name. Specifically...
>
> # build the foo library and link it against math
> ADD_LIBRARY(foo foo.c)
> TARGET_LINK_LIBRARIES(foo math)
>
> # build the foo executable and link it against the spanish lib
> ADD_EXECUTABLE(foo main.c)
> TARGET_LINK_LIBRARIES(foo spanish)
>
>
> Clearly the second TARGET_LINK_LIBRARIES call is ambiguous. There are a
> few options on how to address this and I'm looking for feedback. Here are a
> few different options for disambiguating the targets...
>
> TARGET_LINK_LIBRARIES(foo_EXE Spanish)
>
> TARGET_LINK_LIBRARIES(foo:EXE Spanish)
>
> EXECUTABLE_TARGET_LINK_LIBRARIES(foo Spanish)
>
> TARGET_LINK_LIBRARIES(foo EXECUTABLE Spanish)
>
> TARGET_LINK_LIBRARIES(EXECUTABLE foo Spanish)
>
> TARGET_LINK_LIBRARIES(foo Spanish)
>
>
> Any preferences or other ideas... I am working from the assumption that if
> TARGET_LINK_LIBRARIES is called without any of these special signatures the
> default behavior will be to operate on the named target and if there are
ADD_EXECUTABLE(foo main.c)
TARGET_LINK_LIBRARIES(foo LIBRARY foo bar goo)
> more than one target with that name (which is impossible in the current
> CMake so this will be 100% backwards compatible) default to a library
> target. The same issue will happen with SET_TARGET_PROPERTIES etc.
>
> Another option is that CMake simply should not support having an executable
> and library with the same name although it seems reasonable to me.
>
> Thanks
> Ken
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
--
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050614/35b466cd/attachment.pgp
More information about the CMake
mailing list