[CMake] Changing directory layout with Cpack ?

Eric Noulard eric.noulard at gmail.com
Fri Nov 30 09:34:47 EST 2007


2007/11/30, Stephen Collyer <scollyer at netspinner.co.uk>:
> Eric Noulard wrote:
>
> > If you use VisualStudio on Win32 and you want to use the
> > INSTALL target to install your software from VisualStudio
> > you may add to your top level CMakeLists.txt
> >
> > IF (WIN32)
> >     SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR})/install/win32")
> > ENDIF(WIN32)
>
> I don't understand this part. Doesn't this make the win32
> installation dependent upon an absolute path again ?

Yes and No it depends on the CPack generator used
I think NSIS Generator does not use CMAKE_INSTALL_PREFIX at all
since NSIS offers you the choice when you run the installer.

Howevere, I am a poor and relunctant (sometimes forced)
Windows user so my advice
concerning windows related usage may well be stupid :=)

> > Using this scheme you should be able to create a package with CPack
> > which does not contains your absolute path.
> > On Win32 if you use NSIS CPack generator you will be prompt
> > by the NSIS installer to chose the prefix before the installation.
> >
> > On Linux you'll depending on the generator used (tgz, RPM, DEB)
> > you'll get a binary package containing:
> >
> > For RPM and DEB
> > ${CMAKE_INSTALL_PREFIX}/bin
> > ${CMAKE_INSTALL_PREFIX}/lib
> >
> > For TGZ
> > <some-prefix-using-system-name>/bin
> > <some-prefix-using-system-name>/lib
> >
> > the default value of CMAKE_INSTALL_PREFIX on linux is "/usr/local"
> > but you may change this with a SET if you need that.
>
> I'm not sure what you mean by "change this with a SET" - once I've
> build the packages, I can't change anything at all, can I ?

No you can't that's right (unless the CPack generator authorize it like NSIS)
You may change it at CMake time either using
cmake -DCMAKE_INSTALL_PREFIX=...
or
SET(MAKE_INSTALL_PREFIX "...") in the CMakeLists.txt

What I meant was
may be the default value "/usr/local" is not the good choice
for you and you'll have to change it.

> > The short advice is DOT NOT USE absolute path in INSTALL commands
> > unless you __REALLY__ want to have absolute path INSTALL.
>
> Right. Thanks for the help.

Which CPack generator will you use?
NSIS, TGZ, ZIP, RPM, DEB ?
Are you using CMake CVS or CMake 2.4.x ?

-- 
Erk


More information about the CMake mailing list