<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 23, 2019 at 10:27 PM hex <<a href="mailto:hex7c3@gmail.com">hex7c3@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF">
    <p>hello community,</p>
    <p>Following an example on the usage of IMPORTED_OBJECTS from the
      book "Professional CMake"<br></p></div></blockquote><div>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):</div><div><br></div><div><a href="https://crascit.com/contact/">https://crascit.com/contact/</a><br></div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><p>
    </p>
    <p>I receive the following error:</p>
    <p><i>Error evaluating generator expression:</i><i><br>
      </i><i><br>
      </i><i>    $<TARGET_SOURCES:</i><i>myObjLib></i><i><br>
      </i><i><br>
      </i><i>  Expression did not evaluate to a known generator
        expression</i></p>
    <p><br>
    </p>
    <p>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).<br></p></div></blockquote><div>Yes it is an error, it should have been <font face="courier new, monospace">$<TARGET_OBJECTS:myObjLib></font>. It will be corrected in the next update. Thanks.</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><p>
    </p>
    <p>this is the original CMakeLists.txt:<br>
    </p>
    add_library(myObjLib OBJECT IMPORTED)<br>
    set_target_properties(myObjLib PROPERTIES<br>
       IMPORTED_OBJECTS /some/path/obj1.obj<br>
                        /some/path/obj2.obj<br>
    )<br>
    <p>add_executable(myExe $<TARGET_SOURCES:myObjLib>)</p></div></blockquote></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>