<div dir="ltr"><br><br><div class="gmail_quote">On Tue, Jun 14, 2011 at 8:04 PM, Andreas Naumann <span dir="ltr"><<a href="mailto:Andreas-Naumann@gmx.net">Andreas-Naumann@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
Am 14.06.2011 18:12, schrieb Kfir Lavi:
<blockquote type="cite"><div><div></div><div class="h5">
<div dir="ltr">Hi,<br>
I need to compile the code twice. Once with -DA and once with -DB<br>
My code look like this:<br>
add_definitions(-DA)<br>
add_library(${mylib_A} SHARED ${myfiles})<br>
remove_definitions(-DA)<br>
<br>
add_definitions(-DB)<br>
add_library(${lib_B} SHARED ${myfiles})<br>
remove_definitions(-DB)<br>
<br>
What cmake does is to define A and then remove it, so in compile time,
there <br>
is now definition of A or B. <br>
<br>
How do I tell cmake that the remove needs to be in compile time?<br>
<br>
Regards,<br>
Kfir<br>
</div>
</div></div><pre><fieldset></fieldset>
_______________________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>
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>
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>
Follow this link to subscribe/unsubscribe:
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
</blockquote>
You want to create two libraries A and B from the same sourcefiles
${myfiles}. The first one have to be compiled with -DA and the second
one with -DB, haven't it?<br>
<br>
So you could simply set the COMPILE_FLAGS property with<br>
add_library(A ${myfiles})<br>
add_library(B ${myfiles})<br>
<br>
set_target_properties(A PROPERTIES COMPILE_FLAGS "-DA")<br>
set_target_properties(B PROPERTIES COMPILE_FLAGS "-DB")<br>
<br>
Regards,<br>
Andreas<br></div></blockquote><div><br>Thanks,<br>This solved my problems.<br><br>Again thanks,<br>Kfir <br></div></div></div>