<p>Try prefixing definitions with -D</p>
<p>On Mar 28, 2011 10:26 PM, &quot;David Doria&quot; &lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt; wrote:<br type="attribution">&gt; I have setup a list of definitions:<br>&gt; <br>&gt; SET(MAIN_BUILD_DEFINITIONS &quot;${MAIN_BUILD_DEFINITIONS} UNIX;&quot;)<br>
&gt; SET(MAIN_BUILD_DEFINITIONS &quot;${MAIN_BUILD_DEFINITIONS} PIXEL_DIMENSION=3;&quot;)<br>&gt; <br>&gt; I display them and apply them to my executable as follows:<br>&gt; <br>&gt; add_executable(ImageCompleter ${MainSources})<br>
&gt; message(&quot;Main build definitions: &quot; ${MAIN_BUILD_DEFINITIONS})<br>&gt; set_target_properties(ImageCompleter PROPERTIES COMPILE_DEFINITIONS<br>&gt; &quot;${MAIN_BUILD_DEFINITIONS}&quot;)<br>&gt; <br>&gt; The output is:<br>
&gt; Main build definitions:  UNIX PIXEL_DIMENSION=3<br>&gt; <br>&gt; which looks correct (i.e. UNIX was defined)<br>&gt; <br>&gt; However, in my code there is:<br>&gt; <br>&gt; #if defined(UNIX)<br>&gt;         ... some code...<br>
&gt; #else<br>&gt; #error &quot;Not implemented for this platform!&quot;<br>&gt; #endif<br>&gt; <br>&gt; When I build, the error is produced, indicating that UNIX was not defined.<br>&gt; <br>&gt; I created a small standalone example and it worked as expected... any<br>
&gt; suggestions of what else to check?<br>&gt; <br>&gt; Thanks,<br>&gt; <br>&gt; David<br>&gt; _______________________________________________<br>&gt; Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>&gt; <br>
&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>&gt; <br>&gt; Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt; <br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></p>