Hello,

I'm trying to understand how my C++ application can be compiled using CMake. 

Actually, there is an include file (foo.h) which contains this line 
boost::shared_ptr<imp> _p;
but which doesn't contain #include <boost/shared_ptr.hpp>.
I can't see any include or source file in my application which includes 
boost/shared_ptr.hpp, and which could permit boost/shared_ptr.hppto be 
indirectly included in foo.h.


This line is needed In the CMakeLists.txt for the compilation to succeed : 
ADD_DEFINITIONS(-DUSE_BOOST_REGEX)

When I generate the Makefile using this CMakeLists.txt, a DependInfo.cmake file 
and a flags.make file are also generated.

DependInfo.cmake contains (among other things):


# Preprocessor definitions for this target.
SET(CMAKE_TARGET_DEFINITIONS
    "DEBUG"
    "DEBUG_LOG"
    "USE_BOOST_REGEX"
    ...
    )

flags.make contains (among other things):


# compile CXX with /usr/bin/c++
CXX_DEFINES = DEBUG -DDEBUG_LOG -DUSE_BOOST_REGEX


Thus USE_BOOST_REGEX is a flag used by the preprocessor to enabled the 
compilation of boost_regex component (if not already done).


But I cant' see anything like  


#ifdefined USE_BOOST_REGEX 

#include <boost/shared_ptr.hpp> 

#endif

in any of my application include or source files. 


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?


Thank in advance for your help.


Regards,

Camille
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to