CMake-CPack Package Installation Path Nightmare

Viewed 11301

I've been frustrated by the the CMake-CPack for almost one week.

The bad thing is the CMake-CPack online documentation does not document this part well.

After googling, I found this variables to use:

CPACK_PACKAGING_PREFIX          # NOT documented
CMAKE_INSTALL_PREFIX            # Documented, but the behavior seems weird
CPACK_INSTALL_PREFIX            # NOT documented
CPACK_PACKAGE_INSTALL_DIRECTORY # Documented, but this variable does NOT work as the online document described
CPACK_PACKAGING_INSTALL_PREFIX  # NOT documented

What I am trying to do is: package a Debian package using fakeroot make package, when the package is installed by sudo dpkg -i MyProgramPackageName, install it to /usr/local, with a subdirectory MyProgramPackageName. That is, all files should be installed under /usr/local/MyProgramPackageName-V.1.2.3.

I've been trying (CMake 2.8.3 and CMake 2.8.5) to tune these variables. I tried so many combinations, but failed.

The only way succeeded is:

Set(CPACK_PACKAGING_INSTALL_PREFIX /usr/local/MyProgramPackageName-V.1.2.3)

But this variable is NOT even documented, and the behavior cannot be guaranteed. If you are confused with my question, please advise me when to use CPACK_PACKAGE_INSTALL_DIRECTORY? because the documentation description about this variable is really attractive, and it is really what I want, but I just could not make it working.

Please advise me.

Peter

2 Answers
Related