[CMake] Adding files to ARCHIVE packages only in CPack
Bruno Barberi Gnecco
brunobg at corollarium.com
Thu Sep 24 16:42:11 EDT 2015
How is it possible to add some files only to the ARCHIVE generators with CMake/CPack?
Apparently components do that, but I can't figure how to say "only add component X to
generator Y". I did something like this:
In CPackConfig.cmake:
set(CPACK_PROJECT_CONFIG_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CMakeCPackOptions.cmake")
In CMakeCPackOptions.cmake
IF (CPACK_GENERATOR MATCHES "TGZ")
install(FILES myextrafile DESTINATION "." COMPONENT static)
ENDIF()
But I get the following error:
/usr/local/bin/cpack --config ./CPackConfig.cmake
CMake Error at CMakeModules/CMakeCPackOptions.cmake:4 (install):
Unknown CMake command "install".
CPack Error: Cannot initialize the generator TGZ
What am I doing wrong? Any other way to run `install()` only for certain generators? Thanks
More information about the CMake
mailing list