<div dir="ltr">Cool, this did the trick. It was needed a post-build step to rename the target but it works.<div>Thank you</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 2:19 PM, Chuck Atkins <span dir="ltr"><<a href="mailto:chuck.atkins@kitware.com" target="_blank">chuck.atkins@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Sounds like what you want is an object library, <a href="http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library" target="_blank">http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library</a>:<br><br></div><span style="font-family:courier new,monospace">set(FOO_SOURCES<br></span></div><span style="font-family:courier new,monospace">  Foo1.cxx<br></span></div><span style="font-family:courier new,monospace">  Bar2.cxx<br></span></div><span style="font-family:courier new,monospace">  FooBar3.cxx<br>)<br></span></div><span style="font-family:courier new,monospace">add_library(FooObjLib OBJECT ${FOO_SOURCES})<br><br></span></div><span style="font-family:courier new,monospace">add_executable(A $<TARGET_OBJECTS:FooObjLib>)<br>set_target_properties(A PROPERTIES LINK_FLAGS "/Special /Flags /For /A")<br><br>add_executable(B $<TARGET_OBJECTS:FooObjLib>)<br>set_target_properties(B PROPERTIES LINK_FLAGS "/Special /Flags /For /B")</span><span class="HOEnZb"><font color="#888888"><br><br></font></span></div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div dir="ltr">- Chuck<br></div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Thu, Sep 11, 2014 at 2:09 PM, fungos <span dir="ltr"><<a href="mailto:fungos@gmail.com" target="_blank">fungos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, but will this _recompile_ the sources for each target? We must use the same generated object files for the two outputs, the only difference must be the linker flags.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 1:20 PM, Robert Maynard <span dir="ltr"><<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Generally the easiest way is to have two targets that share the same<br>
source files but have different linker flags.<br>
<div><div><br>
On Thu, Sep 11, 2014 at 12:53 PM, fungos <<a href="mailto:fungos@gmail.com" target="_blank">fungos@gmail.com</a>> wrote:<br>
> Yes, we can say that.. in reality I need two outputs for a single target,<br>
> but these outputs are generated almost exactly with just 2 different linker<br>
> flags removed.<br>
><br>
><br>
> On Thu, Sep 11, 2014 at 11:31 AM, Robert Maynard<br>
> <<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>> wrote:<br>
>><br>
>> Are you trying to generate two different libraries from the same target?<br>
>><br>
>> On Thu, Sep 11, 2014 at 10:45 AM, fungos <<a href="mailto:fungos@gmail.com" target="_blank">fungos@gmail.com</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > How can I create two linker steps with different flags for the same<br>
>> > target<br>
>> > at the same build?<br>
>> ><br>
>> > Example:<br>
>> ><br>
>> >   target: X<br>
>> >     link: linker.exe libs_for_a linker_flags_for_a -o A/X.bin<br>
>> >     link: linker.exe libs_for_b linker_flags_for_b -o B/X.bin<br>
>> ><br>
>> > Thanks<br>
>> ><br>
>> ><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:<br>
>> > <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<br>
>> > 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<br>
>> > <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>
><br>
><br>
><br>
><br>
> --<br>
> Animal Liberation Front<br>
> <a href="http://www.animal-liberation.com/" target="_blank">http://www.animal-liberation.com/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Animal Liberation Front<br><a href="http://www.animal-liberation.com/" target="_blank">http://www.animal-liberation.com/</a>
</div>
</div></div><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></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Animal Liberation Front<br><a href="http://www.animal-liberation.com/">http://www.animal-liberation.com/</a>
</div>