<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 13, 2014 at 3:18 AM, marco restelli <span dir="ltr"><<a href="mailto:mrestelli@gmail.com" target="_blank">mrestelli@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Petr,<br>
   thanks, very informative!<br>
<br>
2014-08-13 9:20 GMT+0200, Petr Kmoch <<a href="mailto:petr.kmoch@gmail.com">petr.kmoch@gmail.com</a>>:<br>
<div class="">> Hi Marco.<br>
><br>
> Sane compilers allow later command-line options to override earlier ones,<br>
> so what you're doing should be fine. Unfortunately, I know some Fortran<br>
> compilers are not sane in this regard.<br>
<br>
</div>Here, I would really like to reduce as much as possible the flags<br>
regardless of the chosen compiler, so "undoing" the chosen flags<br>
seems to me cumbersome and compiler dependent, compared to resetting<br>
them altogether. I like the idea of OBJECT libraries better (it also<br>
solves other problems I have, I did not know about it!).<br>
<div class=""><br>
> If you really need to solve this by explicitly modifying the global list<br>
> for a particular file, the only thing I can think of is move those files to<br>
> a separate CMakeList and turn them into an object library:<br>
<br>
</div>This almost works, I have a problem specifying liking dependencies for<br>
the OBJECT libraries. With a normal library, I can use<br>
<br>
TARGET_LINK_LIBRARIES( my_library ${other_libs_my_library_depends_on} )<br>
<br>
but if my_library is OBJECT I see the error<br>
<br>
  Object library target "my_library" may not link to anything.<br></blockquote><div><br></div><div>See <a href="http://www.cmake.org/cmake/help/v3.0/command/add_library.html">http://www.cmake.org/cmake/help/v3.0/command/add_library.html</a> for the correct way to do things with object libraries - for this purpose, they are closer to source files than libraries, which makes sense given that there's not actually a library written to disk anywhere.</div>
<div><br></div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
One option would be adding the TARGET_LINK_LIBRARIES to the STATIC<br>
library where the TARGET_OBJECTS are used, but this seems to<br>
contradict the modularity idea of the OBJECT libraries. Is there a<br>
better solution?<br>
<div class=""><div class="h5"><br>
Marco<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><br>
</div></div></blockquote></div><br></div></div>