[CMake] import objects to CMake

hex hex7c3 at gmail.com
Tue Jul 23 08:27:50 EDT 2019


hello community,

Following an example on the usage of IMPORTED_OBJECTS from the book 
"Professional CMake"

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).

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>)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190723/71340e51/attachment.html>


More information about the CMake mailing list