mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 22:10:32 +00:00
cpack: Fix CPACK_PACKAGING_INSTALL_PREFIX handling for archives (#14677)
Fix the case when the archive generator is used to package components with an install prefix.
This commit is contained in:
parent
51b4321e5f
commit
e3f84fc504
@ -63,6 +63,14 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
|
|||||||
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
||||||
filePrefix += "/";
|
filePrefix += "/";
|
||||||
}
|
}
|
||||||
|
const char* installPrefix =
|
||||||
|
this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
|
||||||
|
if(installPrefix && installPrefix[0] == '/' && installPrefix[1] != 0)
|
||||||
|
{
|
||||||
|
// add to file prefix and remove the leading '/'
|
||||||
|
filePrefix += installPrefix+1;
|
||||||
|
filePrefix += "/";
|
||||||
|
}
|
||||||
std::vector<std::string>::const_iterator fileIt;
|
std::vector<std::string>::const_iterator fileIt;
|
||||||
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
|
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
|
||||||
++fileIt )
|
++fileIt )
|
||||||
|
@ -862,6 +862,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
|
set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
|
||||||
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
|
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
|
||||||
set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
|
set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK})
|
||||||
|
set(CTEST_RUN_CPackComponentsPrefix ${CTEST_TEST_CPACK})
|
||||||
|
|
||||||
# Do not try to build RPM
|
# Do not try to build RPM
|
||||||
if (NOT RPMBUILD_EXECUTABLE)
|
if (NOT RPMBUILD_EXECUTABLE)
|
||||||
@ -1035,6 +1036,33 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CTEST_RUN_CPackComponentsPrefix)
|
||||||
|
set(CPackComponents_BUILD_OPTIONS)
|
||||||
|
if(APPLE)
|
||||||
|
set(CPackComponents_BUILD_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
|
||||||
|
endif()
|
||||||
|
if(NOT NSIS_MAKENSIS_EXECUTABLE)
|
||||||
|
set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS}
|
||||||
|
-DCPACK_BINARY_NSIS:BOOL=OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_test(CPackComponentsPrefix ${CMAKE_CTEST_COMMAND}
|
||||||
|
--build-and-test
|
||||||
|
"${CMake_SOURCE_DIR}/Tests/CPackComponentsPrefix"
|
||||||
|
"${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix"
|
||||||
|
${build_generator_args}
|
||||||
|
--build-project CPackComponentsPrefix
|
||||||
|
--build-two-config
|
||||||
|
--build-target package
|
||||||
|
--build-options ${build_options}
|
||||||
|
-DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
|
||||||
|
-DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
|
||||||
|
-DCPACK_BINARY_ZIP:BOOL=ON
|
||||||
|
${CPackComponents_BUILD_OPTIONS}
|
||||||
|
)
|
||||||
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsPrefix")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CTEST_package_X11_TEST)
|
if(CTEST_package_X11_TEST)
|
||||||
set(X11_build_target_arg --build-target package)
|
set(X11_build_target_arg --build-target package)
|
||||||
else()
|
else()
|
||||||
|
13
Tests/CPackComponentsPrefix/CMakeLists.txt
Normal file
13
Tests/CPackComponentsPrefix/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
project(CPackComponentsPrefix NONE)
|
||||||
|
|
||||||
|
install(FILES file-runtime.txt
|
||||||
|
DESTINATION bin COMPONENT Runtime)
|
||||||
|
install(FILES file-development.txt
|
||||||
|
DESTINATION lib COMPONENT Development)
|
||||||
|
|
||||||
|
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 1)
|
||||||
|
set(CPACK_COMPONENTS_ALL Development)
|
||||||
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL 1)
|
||||||
|
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/My-1.0")
|
||||||
|
include(CPack)
|
1
Tests/CPackComponentsPrefix/file-development.txt
Normal file
1
Tests/CPackComponentsPrefix/file-development.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file is installed with the Development component.
|
1
Tests/CPackComponentsPrefix/file-runtime.txt
Normal file
1
Tests/CPackComponentsPrefix/file-runtime.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file is installed with the Runtime component.
|
Loading…
Reference in New Issue
Block a user