Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ option(OPTION_BUILD_TESTS "Build tests."
option(OPTION_BUILD_DOCS "Build documentation." OFF)
option(OPTION_BUILD_EXAMPLES "Build examples." OFF)

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(OPTION_DEPLOY_DESTDIR "" CACHE STRING "Emulates the DESTDIR convention of make install.")
endif()


#
# Declare project
Expand Down
12 changes: 12 additions & 0 deletions deploy/packages/pack-template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ add_custom_target(
)
set_target_properties(pack-${project_name} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)

# Create per-component install targets
if(OPTION_DEPLOY_DESTDIR AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
foreach(component ${CPACK_COMPONENTS_ALL})
add_custom_target(
destdir-deploy-${component}
COMMAND make preinstall
COMMAND DESTDIR=${OPTION_DEPLOY_DESTDIR} ${CMAKE_COMMAND} -DCOMPONENT=${component} -P cmake_install.cmake
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endforeach()
endif()

# Set dependencies
add_dependencies(pack pack-${project_name})
if(MSVC)
Expand Down