[CMake] Changing default cpack installation path

Dizzy dizzy at roedu.net
Tue Oct 2 03:36:23 EDT 2007


On Monday 01 October 2007 21:33:35 Kedzierski, Artur CIV NAVSURFWARCENDIV 
CORONA wrote:
> 	Hi,
>
> 	Is there a way to change the default installation path in cpack?
> This is for NSIS installer on Windows. I tried changing
> CPACK_PACKAGE_INSTALL_DIRECTORY but
> no matter what I set it to, "Program Files" always gets added. Anyway
> to get around it?

I do not know if it is possible to specify other default installation paths 
for CPack generators, or for NSIS. In general with INSTALL() commands I do 
not use CMAKE_INSTALL_PREFIX directly (which on Win32 is by default "%System 
Drive%\Program Files" or "/usr/local" on Unix) but I use other variables that 
are built upon CMAKE_INSTALL_PREFIX depending on the target platform and 
such. Like:
IF(UNIX)
 SET(BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
ELSE(UNIX)
 SET(BINDIR <something else>)
ENDIF(UNIX)

And then INSTALL(TARGETS myTarget DESTINATION ${BINDIR})

Maybe a similar scheme may affect CPack packages (which AFAIK do consider 
INSTALL() commands to follow the paths of installed files).

> 	We use CPack to package some libraries to install them on
> programmer's workstations. However, their Find*.cmake that come with
> Cmake
> expects them in specific locations. For example, FindBoost.cmake
> wants Boost in '/boost' or FindZlib.cmake wants zlib in '/usr'. I don't
> want
> users installing these packages to remember to change these paths to
> correct
> values. I would like the installation process to be clicking 'next',
> 'next', 'finish' buttons.

I do not understand what you ask here (probably because of my lack of 
experience with CPack). In general, if some Find package module does not 
satisfy you then you can hack it to detect your paths if that is possible. 
Example: I have a modified FindZLIB that looks up registry keys if you 
installed zlib from gnuwin32 package. In general it is impossible to know 
where the user installed something on a system if it is not a standard 
location that you may look in that list of paths to look for or if it does 
not register in some standard way (like with the Windows registry) or the 
user does not specify the location manually.

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list