[CMake] make package_source and binary subdir of source

Mathieu Malaterre mathieu.malaterre at gmail.com
Fri Mar 7 05:09:11 EST 2008


hi,

  when running 'make package_source' you can end having your whole
binary tree being included in your src package. To prevent that, your
binary tree should be *outside* of your source tree. I have added at
the top of my project:

STRING(COMPARE EQUAL "${GDCM_SOURCE_DIR}" "${GDCM_BINARY_DIR}" INSOURCE)
GET_FILENAME_COMPONENT(PARENTDIR ${GDCM_BINARY_DIR} PATH)
STRING(COMPARE EQUAL "${GDCM_SOURCE_DIR}" "${PARENTDIR}" INSOURCESUBDIR)
IF(INSOURCE OR INSOURCESUBDIR)
  MESSAGE(FATAL_ERROR "GDCM requires an out of source Build. "
    "Please create a separate binary directory and run CMake there.")
ENDIF(INSOURCE OR INSOURCESUBDIR)

HTH

-- 
Mathieu


More information about the CMake mailing list