[CMake] newbie q - where do I put what in which CMakeLists file? out of source build

Eric Noulard eric.noulard at gmail.com
Thu Mar 10 03:15:38 EST 2011


2011/3/10 David Cole <david.cole at kitware.com>:
> Well if the build directory is *in* the source directory, then make
> package_source *should* include it.
>
> This is not a problem, but the expected behavior.
> If you don't want the build tree in the source tree, then don't put it
> there.

Or do include "${CMAKE_BINARY_DIR}/*" in "CPACK_SOURCE_IGNORE_FILES"

Note that there is a special case where excluding CMAKE_BINARY_DIR is annoying,
this is when you do in-source build, i.e.
if CMAKE_BINARY_DIR == CMAKE_SOURCE_DIR.

What I usually do is:

IF ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
   SET(CPACK_SOURCE_IGNORE_FILES <usual list>)
ELSE("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
     SET(CPACK_SOURCE_IGNORE_FILES "<usuallist>;${CMAKE_BINARY_DIR}/*")
ENDIF ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list