<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hello,<br></div><div><br></div><div>I'm trying to understand how my C++ application can be compiled using CMake. <br></div><div>Actually, there is an include file (<span style="font-weight: bold;">foo.h</span>) which contains this line <span style="font-weight: bold;">boost::shared_ptr<imp> _p;</span></div><div>but which doesn't contain <span style="font-weight: bold;">#include <boost/shared_ptr.hpp></span><span style="font-style: italic;">.</span></div><div><span style="font-style: italic;"> </span>I can't see any include or source file in my application which includes <span style="font-weight: bold;">boost/shared_ptr.hpp</span><span>, and which could permit </span><span style="font-weight: bold;">boost/shared_ptr.hpp</span><span> to </span><span>be indirectly included in <span style="font-weight: bold;">foo.h</span><span
style="font-weight: bold;"></span><span>.</span><br></span></div><div><span><br></span></div><div><span>This line is needed In the CMakeLists.txt for the compilation to succeed : </span><span style="font-weight: bold;">ADD_DEFINITIONS(-DUSE_BOOST_REGEX)</span></div><div><br></div><div>When I generate the Makefile using this CMakeLists.txt, a <span style="font-weight: bold;">DependInfo.cmake</span> file and a <span style="font-weight: bold;">flags.make</span> file are also generated.</div><div><br></div><div><span style="font-weight: bold;">DependInfo.cmake</span> contains (among other things):<br></div><div><br></div><div style="font-weight: bold;"># Preprocessor definitions for this target.<br>SET(CMAKE_TARGET_DEFINITIONS</div><div style="font-weight: bold;"><span class="tab"> </span>"DEBUG"<br> "DEBUG_LOG"<br> "USE_BOOST_REGEX"</div><div style="font-weight: bold;"> ...</div><div
style="font-weight: bold;"> )</div><div style="font-weight: bold;"><br></div><div><span style="font-weight: bold;">flags.make</span> contains (among other things):<br>
</div>
<div><br></div><div style="font-weight: bold;"># compile CXX with /usr/bin/c++</div><div><span style="font-weight: bold;">CXX_DEFINES = DEBUG -DDEBUG_LOG -DUSE_BOOST_REGEX</span><br></div><span style="font-weight: normal;"></span><span style="font-weight: normal;"><span></span></span><div><br></div><div>Thus <span style="font-weight: bold;">USE_BOOST_REGEX</span> is a flag used by the preprocessor to enabled the compilation of <span style="font-weight: bold;">boost_regex</span> component (if not already done).<br><span><span></span></span></div><div style="font-weight: bold;"><span><span style="font-weight: normal;"><br></span></span></div><div style="font-weight: bold;"><span><span style="font-weight: normal;">But I cant' see anything like </span><span style="font-weight: bold;"><br></span></span></div><div><br></div><div style="font-weight: bold;">#ifdefined USE_BOOST_REGEX <br></div><div style="font-weight: bold;">#include
<boost/shared_ptr.hpp> <br></div><div><span style="font-weight: bold;">#endif</span></div><div><br></div><div>in any of my application include or source files. <br></div><div><br></div><div>So, how does this flag work? Is it related to CMake or only with gcc? My knowledge about how CXX_DEFINES works are quite limited. Do all "USE*" preprocessor flags work in the same way? Generally, when do I have to add this kind of preprocessor definitions?<br></div><div><br></div><div>Thank in advance for your help.<br></div><div><br></div><div>Regards,</div><div><br></div><div>Camille</div></div></body></html>