[CMake] CMake Marketing

Brad King brad.king at kitware.com
Fri Dec 23 14:34:10 EST 2005


E. Wing wrote:
> I also love CMake's out-of-source build feature. I hate mixing my
> source and object files. But strangely, when I describe this feature
> to others, I seem to get puzzled looks. One thing that is lacking is
> that when new users use CMake for the first time, despite my
> instructions, they always mess-up and do an in-source build. I don't
> know if anything can be done about this, but at the very least, I
> think CMake needs a dist-clean like function that strips away
> everything that CMake generated.

In your CMakeLists.txt file you can test for an in-source build and give 
an error:

# Disallow in-source build
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
        INSOURCE)
IF(INSOURCE)
   MESSAGE(FATAL_ERROR "This project requires an out of source build.")
ENDIF(INSOURCE)

-Brad


More information about the CMake mailing list