<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Am 14.06.2011 18:12, schrieb Kfir Lavi:
<blockquote
cite="mid:BANLkTimh0jnWnQ+Bsvai6b=HcrO98Vhzsg@mail.gmail.com"
type="cite">
<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>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">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>
</body>
</html>