<div dir="ltr"><div>I've not come across the target_sources command before - is it new in 3.1.3 ?  From reading the documentation it looks like it allows one to add sources to a target *after* the target has been created via add_library or add_executable.  If that is true then that could be a very useful command.  I will investigate further but it could be just what I need.<br><br>--<br></div>Glenn<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 30 June 2015 at 22:34, Stephen Kelly <span dir="ltr"><<a href="mailto:steveire@gmail.com" target="_blank">steveire@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Glenn Coombs wrote:<br>
<br>
> I am getting the error in the subject.  The code I have looks like this:<br>
><br>
>     if (PRE_COMPILED_HEADERS_FOUND)<br>
>         ADD_PRECOMPILED_HEADER(${header_pch} ${source_pch} sources<br>
>         systemc)<br>
>     endif()<br>
><br>
>     add_library(systemc ${sources} ${sources_no_pch} ${headers})<br>
><br>
<br>
</span>Use target_sources after the target is created.<br>
<br>
 add_library(systemc ${sources} ${headers})<br>
 if (PRE_COMPILED_HEADERS_FOUND)<br>
   ADD_PRECOMPILED_HEADER(${header_pch} ${source_pch} pch_files systemc)<br>
   target_sources(systemc PRIVATE ${pch_files})<br>
 endif()<br>
<br>
Thanks,<br>
<br>
Steve.<br>
<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>