On Sun, Jan 11, 2009 at 10:00 AM, Wilfried Holzke <cm...@holzke.net> wrote:

> Hi,
>
> > cmake -DWITH_DEMO=ON srcdir
> >
> > in CMakeLists.txt:
> >
> > if(WITH_DEMO)
> >    install( demo ....)
> > endif(WITH_DEMO)
>
> If nothing else depends on the demo code I could do
>
> if(WITH_DEMO)
>  add_subdirectory(example)
> endif(WITH_DEMO)
>
> to avoid building the whole source, right?


Yes.  The above code will stop CMake from building any targets in the
"example" subdirectory.

You can also use the option() command to specify a default for boolean
variables like WITH_DEMO and have it appear as an configurable cache
variable when using "ccmake" or "cmake-gui".

option(WITH_DEMO "Build the examples" OFF)
if(WITH_DEMO)
 add_subdirectory(example)
endif(WITH_DEMO)


-- 
Philip Lowman
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to