Skip to content

Commit

Permalink
CommonCPack: make ABI version in package name optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Dumusc committed Mar 22, 2017
1 parent 57fb7e4 commit e3a2dba
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions CommonCPack.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@

# Copyright (c) 2012-2013 Stefan Eilemann <eile@eyescale.ch>
# Copyright (c) 2013-2017 [email protected]
# Raphael.Dumusc@epfl.ch
# Info: http://www.itk.org/Wiki/CMake:Component_Install_With_CPack
#
# Configures the packaging of the project using CPack.
#
# Also includes CommonPackageConfig (legacy, to be removed in the future).
#
# Input:
# * COMMON_PACKAGE_ABI add the ABI version to the package name (default: ON)

# No support for subproject packaging
if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
include(CommonPackageConfig)
return()
endif()

if(NOT DEFINED COMMON_PACKAGE_ABI)
set(COMMON_PACKAGE_ABI ON)
endif()

if(NOT CPACK_PROJECT_NAME)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
endif()
Expand Down Expand Up @@ -48,7 +59,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_PACKAGE_NAME "${LOWER_PACKAGE_NAME_PREFIX}")

set(OLD_PACKAGES)
if(${PROJECT_NAME}_VERSION_ABI)
if(COMMON_PACKAGE_ABI AND ${PROJECT_NAME}_VERSION_ABI)
set(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}${${PROJECT_NAME}_VERSION_ABI}")
math(EXPR NUM_OLD_PACKAGES "${${PROJECT_NAME}_VERSION_ABI} - 1")
foreach(i RANGE ${NUM_OLD_PACKAGES})
Expand Down

0 comments on commit e3a2dba

Please sign in to comment.