[CMake] Error out on installation when there is already an installation

Michael Hertling mhertling at online.de
Thu Apr 28 08:55:13 EDT 2011


On 04/28/2011 01:51 PM, John R. Cary wrote:
> This is in reference to
> 
> iter.cary$ cmake --version
> cmake version 2.8.3
> iter.cary$ uname -a
> Linux iter.txcorp.com 2.6.29.4-167.fc11.x86_64 #1 SMP Wed May 27 
> 17:27:08 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
> 
> 
> We have a situation where a package needs to be
> rebuilt because some dependency is rebuilt.  In
> this case, trilinos needs rebuilding because it
> depends on openmpi and the version of opempi gets
> updated.
> 
> Typically, these installations are in a common area,
> but by different people.  So one night Joe triggers
> a build a trilinos.  Then the next night a new version
> of openmpi is available, so Mary triggers a build of
> openmpi and then trilinos.
> 
> In this situation, Mary's installation of trilinos
> fails, because cmake's installation does not overwrite
> some files:
> 
> -- Installing: 
> /usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_DLLExportMacro.h
> -- Up-to-date: 
> /usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_AbstractFactory.hpp
> CMake Error at packages/teuchos/src/cmake_install.cmake:54 (FILE):
>    file INSTALL cannot set permissions on
>    
> "/usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_AbstractFactory.hpp"
> Call Stack (most recent call first):
>    packages/teuchos/cmake_install.cmake:48 (INCLUDE)
>    cmake_install.cmake:41 (INCLUDE)
> 
> but then apparently tries to set the permissions anyway.  But
> since it did not overwrite, Mary does not own the files, and
> so she cannot set the perms.  The result being that the installation
> errors out as above, possibly not completing, but at the very
> least returning an error code that must be chased down.
> 
> It seems to me that one should overinstall, even if the
> file is there, if one is going to try to set permissions
> afterwards.  Is there a way to force such overinstallation
> in cmake?  Or perhaps not error out on a perm change if the
> exising perms are okay?
> 
> Thx....John Cary

You might try "make install CMAKE_INSTALL_ALWAYS=1", cf. [1].

Regards,

Michael

[1] http://www.cmake.org/Wiki/CMake_Useful_Variables


More information about the CMake mailing list