Hi, To enable to handle various packages as part of the same project and to avoid to execute preinstall target before packaging, I rely on CPack variables CPACK_INSTALLED_DIRECTORIES and CPACK_INSTALL_COMMANDS.
Unfortunately, packaging is failing in the following conditions: * Platform Windows (regardless generator: test done with “Visual Studio” and "Ninja”) * Install command with PERMISSIONS read-only (like OWNER_READ) * PROJECT command with LANGUAGES CXX (specifying LANGUAGES NONE is OK !??) In this case, installed read-only files cannot be copied by CPack. Attached is a CMakeLists.txt showing the problem: * Target package-OK generates the expected package (no read-only permissions) * Target package-KO fails to generate the package (same as previous one except read-only permissions) Marc
cmake_minimum_required (VERSION 3.1) project (TEST LANGUAGES CXX) install (FILES file.h PERMISSIONS OWNER_READ GROUP_READ WORLD_READ DESTINATION include COMPONENT KO) install (FILES file.h DESTINATION include COMPONENT OK) set (CPACK_GENERATOR "TGZ") set (install_prefix ${CMAKE_SOURCE_DIR}/INSTALL) set (KO_install_command "${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${install_prefix} -DCOMPONENT=KO -DBUILD_TYPE=$<CONFIG> -P ${CMAKE_BINARY_DIR}/cmake_install.cmake") add_custom_target (package-KO COMMAND "${CMAKE_CPACK_COMMAND}" -C $<CONFIG> -D CPACK_COMPONENTS_ALL=KO -D CPACK_INSTALL_COMMANDS=${KO_install_command} -D CPACK_INSTALLED_DIRECTORIES=${install_prefix}$<SEMICOLON>. --config ./CPackConfig.cmake) set (OK_install_command "${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${install_prefix} -DCOMPONENT=OK -DBUILD_TYPE=$<CONFIG> -P ${CMAKE_BINARY_DIR}/cmake_install.cmake") add_custom_target (package-OK COMMAND "${CMAKE_CPACK_COMMAND}" -C $<CONFIG> -D CPACK_COMPONENTS_ALL=OK -D CPACK_INSTALL_COMMANDS=${OK_install_command} -D CPACK_INSTALLED_DIRECTORIES=${install_prefix}$<SEMICOLON>. --config ./CPackConfig.cmake) include (CPack)
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers