[CMake] OBJECT library and $<TARGET_OBJECTS:...>

Tom Kacvinsky tom.kacvinsky at vectorcast.com
Fri Sep 18 15:44:28 EDT 2015


On Fri, Sep 18, 2015 at 3:08 PM, Tom Kacvinsky <tom.kacvinsky at vectorcast.com
> wrote:

> Snippet:
>
> add_libary(foo OBJECT a.c b.c)
>
> add_custom_command(
>   OUTPUT exports.def
>   COMMAND lib /out:static.lib $<TARGET_OBJECTS:foo>
>   COMMAND python export.py" static.lib exports.def
>   DEPENDS export.py"
> )
>
> Results in:
>
> CMake Error at CMakeLists.txt:289 (add_custom_command):
>   Error evaluating generator expression:
>
>     $<TARGET_OBJECTS:foo>
>
>   Expression did not evaluate to a known generator expression
>
> What am I doing wrong?  I am using cmake 2.8.11.2 on windows and my
> understanding is that the TARGET_OBJECTS generator expression was
> introduced in 2.8.8
>
> Thanks,
>
> Tom
>
>
I figured it out.  That generator expression is only valid inside an
add_library or add_executable target.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150918/a3bdd86b/attachment.html>


More information about the CMake mailing list