That bug is regarding "CMAKE_STATIC_LINKER_FLAGS<br><br>What about this bug report: <br><a href="http://www.cmake.org/Bug/view.php?id=12295">http://www.cmake.org/Bug/view.php?id=12295</a><br>which is related to STATIC_LIBRARY_FLAGS<br>
<br><br><div class="gmail_quote">On 1 December 2012 16:00, Timothy J. Arrington <span dir="ltr"><<a href="mailto:sse3ml@gmail.com" target="_blank">sse3ml@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The bug is already reported for quite a while:<br>
<a href="http://public.kitware.com/Bug/view.php?id=10094" target="_blank">http://public.kitware.com/Bug/view.php?id=10094</a>, but so far, hasn't<br>
been fixed.<br>
<br>
2012/11/28 Paul Harris <<a href="mailto:harris.pc@gmail.com">harris.pc@gmail.com</a>>:<br>
<div><div class="h5">> Hi,<br>
><br>
> I set this:<br>
><br>
> set (STATIC_LIBRARY_FLAGS_RELWITHDEBINFO<br>
> "${STATIC_LIBRARY_FLAGS_RELWITHDEBINFO} /LTCG")<br>
><br>
> and it didn't seem to work. MSVC still has no LTCG flag set for any of my<br>
> static libraries.<br>
><br>
> does this feature work?<br>
> cheers,<br>
> Paul<br>
><br>
><br>
> On 23 June 2011 01:02, Ben Medina <<a href="mailto:ben.medina@gmail.com">ben.medina@gmail.com</a>> wrote:<br>
>><br>
>> So that the answer stays on the list:<br>
>><br>
>> One must use the STATIC_LIBRARY_FLAGS property, rather than<br>
>> LINK_FLAGS, for static libraries.<br>
>><br>
>> On Tue, Jun 21, 2011 at 3:12 PM, Ben Medina <<a href="mailto:ben.medina@gmail.com">ben.medina@gmail.com</a>> wrote:<br>
>> > Since I got no feedback, I assume it's a bug. I've filed it here:<br>
>> ><br>
>> > 0012295: LINK_FLAGS_RELEASE has no effect on static libraries for MSVC<br>
>> > generators<br>
>> ><br>
>> > <a href="http://www.cmake.org/Bug/view.php?id=12295" target="_blank">http://www.cmake.org/Bug/view.php?id=12295</a><br>
>> ><br>
>> > On Mon, Jun 13, 2011 at 11:50 AM, Ben Medina <<a href="mailto:ben.medina@gmail.com">ben.medina@gmail.com</a>><br>
>> > wrote:<br>
>> >> Hello all,<br>
>> >><br>
>> >> I'm using CMake 2.8.4 and am seeing an odd differenc between static<br>
>> >> and shared libraries in regard to the LINK_FLAGS property. In<br>
>> >> particular, I'm enabling "Whole program optimization" in Visual Studio<br>
>> >> 2010, which is done by add /GL as a compiler flag and /LTCG as a<br>
>> >> linker flag for the release configuration. However, the link flag is<br>
>> >> not used for static libraries, leading to a build warning about<br>
>> >> compiling with /GL but linking without /LTCG.<br>
>> >><br>
>> >> Here's an example:<br>
>> >><br>
>> >> cmake_minimum_required (VERSION 2.8)<br>
>> >> project (link_test)<br>
>> >><br>
>> >> set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")<br>
>> >><br>
>> >> add_library (static_test STATIC a.cpp)<br>
>> >> set_target_properties (<br>
>> >> static_test<br>
>> >> PROPERTIES<br>
>> >> LINK_FLAGS_RELEASE "/LTCG"<br>
>> >> )<br>
>> >><br>
>> >> add_library (shared_test SHARED a.cpp)<br>
>> >> set_target_properties (<br>
>> >> shared_test<br>
>> >> PROPERTIES<br>
>> >> LINK_FLAGS_RELEASE "/LTCG"<br>
>> >> )<br>
>> >><br>
>> >> Just add an empty file called a.cpp to the directory, then build the<br>
>> >> whole project in release configuration. You'll get a warning like this<br>
>> >> for the static_test library:<br>
>> >><br>
>> >> 2> a.obj : MSIL .netmodule or module compiled with /GL found;<br>
>> >> restarting link with /LTCG; add /LTCG to the link command line to<br>
>> >> improve<br>
>> >><br>
>> >> Why is CMake not applying LINK_FLAGS_RELEASE to the static library?<br>
>> >><br>
>> >> Thanks,<br>
>> >> Ben<br>
>> >><br>
>> ><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
><br>
><br>
><br>
</div></div>> --<br>
<div class="HOEnZb"><div class="h5">><br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at:<br>
> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br>