[CMake] Strange behaviour on install

Brad King brad.king at kitware.com
Tue Oct 17 15:29:42 EDT 2006


Helio Chissini de Castro wrote:
> Hi
> 
> I got a code similar like this:
> 
> #--------------
> 
> INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/providers.xml 
> DESTINATION /opt/fdo )
> 
> INSTALL( CODE "MAKE_DIRECTORY\( /opt/fdo/Repositories/Library/DataFiles\)" )
> 
> #-------------
> 
> If i install as a root using "make install"
> /opt/fdo/providers.xml
> /opt/fdo/Repositories/Library/DataFiles
> 
> But if i use make DESTDIR=/tmp/test install, i got:
> /opt/fdo/providers.xml 

Do you mean "make DESTDIR=/tmp/test" gives

/tmp/test/opt/fdo/providers.xml
/opt/fdo/Repositories/Library/DataFiles

?

> And the directory isn't created.
> Is there some trick to make MAKE_DIRECTORY works with DESTDIR on install ?

MAKE_DIRECTORY is just a CMake command and knows nothing of installation
or DESTDIR.  You need to reference it yourself.  Also note the docs for
MAKE_DIRECTORY say it is deprecated and that you should use FILE:

INSTALL(CODE "
FILE(MAKE_DIRECTORY $ENV{DESTDIR}/opt/fdo/Repositories/Library/DataFiles)
")

-Brad


More information about the CMake mailing list