[CMake] make package_source and binary subdir of source

Eric Noulard eric.noulard at gmail.com
Fri Mar 7 07:00:51 EST 2008


2008/3/7, Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> hi,
>
>   when running 'make package_source' you can end having your whole
>  binary tree being included in your src package.

That's perfectly true.
Moreover the Eclipse CDT4 generator works better if your build
tree is inside the source ;-)

> 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)

My opinion would be that the CPack source generator should take
care of that automagically by excluding

${CMAKE_BINARY_DIR}/* from the packaged _SOURCE_ file.

The following should do the trick:
SET(CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}/*")

but may CPack should automatically add ${CMAKE_BINARY_DIR}/*
to CPACK_SOURCE_IGNORE_FILES?

I'll try a patch of the CMake/Modules/CPack.cmake
Will post a bug entry.


-- 
Erk


More information about the CMake mailing list