[CMake] How to check if CMake install script is being run by CPack?

Nazar Mishturak nazarmx at gmail.com
Sun Dec 27 03:02:28 EST 2015


Hi, I am new here! I have a problem with my install(SCRIPT), it does
fixup_bundle for all targets under ${CMAKE_INSTALL_PREFIX} and strip &
upx all executables + .dlls under it. But I want to do upx and strip
only when I am creating a package(make package, not make install).
I have tried using:

if(DEFINED CPACK_OUTPUT_CONFIG_FILE)
if(DEFINED CPACK_PROJECT_CONFIG_FILE)
if(DEFINED CPACK_GENERATOR)

As far as I understand CPack just installs using CMake somewhere into
package directory. But I don't know if its possible to use this.
Should I check these variables in CMakeLists.txt and use
configure_file to pass variables to the script?


More information about the CMake mailing list