[CMake] avoiding complete rebuild when the user changes

Eric Noulard eric.noulard at gmail.com
Wed Apr 18 07:00:45 EDT 2012


2012/4/18 pellegrini <pellegrini at ill.fr>:
> Dear CMakers,
>
> I introduced recently a colleague of mine to the wonders of cmake. He has a
> problem that neither he or me could solve.
>
> When he cmakes and builds his project as root and builds subsenquently  its
> project as himself the whole project is rebuilt even if
> nothing has been changed.

Building as root is evil and cmake try it hard to discourage the practice
by rebuilding over & over :-]

> I may be wrong but I think this is not an actual problem with cmake but
> rather a general property of make that do not consider only the
> timestamp but also the owner of a file and if one of these changes, the file
> is marked as having to be rebuild.

A nice idea suggested by Bill sometimes ago was to.


0) Create a pristine  git repo

1) Add the source and an empty build dir to the repo
    commit.

1) Build out of source in the build dir.
    add+commit all thing in the build dir.

2) Try "make"
    then git diff or git status in order to see what have changed.

>
> What do you think ? Would you see one way to escape from this feature ?

avoid building as root?

Why would he need to build as root in the first place?
Usually only the ultimate install step may need root privilege, and for that one
$ sudo make install
may be simple enough?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list