[CMake] Changing directory layout with Cpack ?
Stephen Collyer
scollyer at netspinner.co.uk
Fri Nov 30 09:10:08 EST 2007
Eric Noulard wrote:
> In a first step do not set CMAKE_INSTALL_PREFIX.
> Later you may uncomment and update this
> #SET(CMAKE_INSTALL_PREFIX "/some/prefix")
>
>> and in a lower level directory, src/lib, I have:
>>
> IF (WIN32)
> INSTALL(TARGETS Comms Runnable
> ARCHIVE DESTINATION .
> LIBRARY DESTINATION .
> RUNTIME DESTINATION .
> )
> ELSE(WIN32)
> INSTALL(TARGETS Comms Runnable
> ARCHIVE DESTINATION lib
> LIBRARY DESTINATION lib
> RUNTIME DESTINATION bin
> )
> ENDIF(WIN32)
>
> Then after a compilation you may
>
> On Linux (from within your linux build tree)
> make DESTDIR=/<your_absolute_prefix>/install/linux install
> or
> On Win32 (from within your Win32 build tree)
> make DESTDIR=/<your_absolute_prefix>/install/win32 install
OK. So this method removes absolute paths from the cmake files,
allowing you to specify them at install time.
> 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 ?
> 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 ?
> 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.
--
Regards
Steve Collyer
Netspinner Ltd
More information about the CMake
mailing list