[CMake] import objects to CMake

Craig Scott craig.scott at crascit.com
Tue Jul 23 08:55:33 EDT 2019


On Tue, Jul 23, 2019 at 10:27 PM hex <hex7c3 at gmail.com> wrote:

> hello community,
>
> Following an example on the usage of IMPORTED_OBJECTS from the book
> "Professional CMake"
>
I'm happy to accept corrections and suggestions for the book at the
following link (it's a more appropriate channel than here on this list):

https://crascit.com/contact/



> I receive the following error:
>
> *Error evaluating generator expression:*
>
> *    $<TARGET_SOURCES:**myObjLib>*
>
> *  Expression did not evaluate to a known generator expression*
>
>
> I wonder if there is a mistake in the code snippet? I was able to make it
> work using TARGET_OBJECTS instead of TARGET_SOURCES (CMake 3.15).
>
Yes it is an error, it should have been $<TARGET_OBJECTS:myObjLib>. It will
be corrected in the next update. Thanks.




> this is the original CMakeLists.txt:
> add_library(myObjLib OBJECT IMPORTED)
> set_target_properties(myObjLib PROPERTIES
>    IMPORTED_OBJECTS /some/path/obj1.obj
>                     /some/path/obj2.obj
> )
>
> add_executable(myExe $<TARGET_SOURCES:myObjLib>)
>

-- 
Craig Scott
Melbourne, Australia
https://crascit.com

Get the hand-book for every CMake user: Professional CMake: A Practical
Guide <https://crascit.com/professional-cmake/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190723/2f0532c7/attachment.html>


More information about the CMake mailing list