[CMake] make package_source and binary subdir of source

Eric NOULARD eric.noulard at gmail.com
Sat Mar 8 12:51:57 EST 2008


Le Fri, 7 Mar 2008 18:18:00 +0100,
Hendrik Sattler <post at hendrik-sattler.de> a écrit :

> Am Freitag 07 März 2008 schrieb Eric Noulard:
> > 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?
> 
> Not really. 
> At least it should check for CMAKE_BINARY_DIR !=
> CMAKE_SOURCE_DIR in this case.

Yes you are right.
This only works for CMAKE_BINARY_DIR being a 
'proper' subtree of CMAKE_SOURCE_DIR.

> It could be a lot smarter when being used in a VCS tree by including
> only files that are version-controlled. 

That's true but then CMake should be aware of the VCS system used
(CVS, SVN, git, etc...).

> OTOH, always making this
> right automatically seems to be an impossible task.

I think it has already been discussed but it wouldn't
be too hard for CMake to guess what is a source:

A) Inclusion rules
A.1) Examines all directories found in an ADD_SUBDIRECTORY
A.2) Take all sources files found in a
     ADD_LIBRARY or ADD_EXECUTABLE
A.3) Take all sources files which are explicitely specified
     by a (to be added)
     set_source_files_properties(file1 file2
                                 PROPERTIES CPACK_PACKAGE_SOURCE true)
     and/or 
     Add files if their name/pattern appear in
     CPACK_SOURCE_ADD_FILES

B) Exclusion rules
B.1) Take only files under ${CMAKE_SOURCE_DIR}
B.2) Ignore files if their name/pattern appear in
     CPACK_SOURCE_IGNORE_FILES

The default behavior may not be always right but I think
it would be better than the today "include all source tree" but
CPACK_SOURCE_IGNORE_FILES we have today?

Is it worth a patch or is the idea totally flawed?

I remember a post from Bill which said that it was difficult for CMake
to know what was generated or not because a built may need several
CMake run before obtaining a functional build tree.
However remembering what is a source seems easier, or am I wrong?




More information about the CMake mailing list