<div dir="ltr"><div>Hi Lukasz.<br><br>I believe you could put `main.cpp` into an object library:<br><br>add_library(foo ${foosources})<br>
add_library(bar ${barsources})<br>
add_library...<br>
...<br>
...<br>add_library(main_sources OBJECT main.cpp)<br>
add_executable(foo_exe $<TARGET_OBJECTS:main_sources>)<br>
target_link_libraries(foo_exe foo bar ... ... ...)<br><br></div>This should make `main.cpp` compilable independently, as only the linking of foo_exe will wait until the libraries (including the object one) are finished.<br>
<br>Petr<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 10:30 AM, Łukasz Tasz <span dir="ltr"><<a href="mailto:lukasz@tasz.eu" target="_blank">lukasz@tasz.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear experts,<br>
<br>
I hit the wall again with order of compilation in generated Makefiles,<br>
<br>
Uscase:<br>
<br>
add_library(foo ${foosources})<br>
add_library(bar ${barsources})<br>
add_library...<br>
...<br>
...<br>
add_executable(foo_exe main.cpp)<br>
target_link_libraries(foo_exe foo bar ... ... ...)<br>
<br>
while libs objects will be compiled in parallel, man.cpp.o will be<br>
compiled after linking of all libs,<br>
If main.cpp is compiling long then this is overall additional waist of<br>
time which could be done much earlier.<br>
<br>
Do you have some ideas how this situation could be optimised?<br>
<br>
with best regards<br>
Łukasz Tasz<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" 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" 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" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" 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" 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" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></blockquote></div><br></div>