3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 12:03:50 +01:00

[cmake] Use PROJECT_VERSION as defined through project(..) over APP4TRIQS_VERSION

This commit is contained in:
Nils Wentzell 2019-06-26 11:35:20 -04:00
parent 24f49da39c
commit b0bb95d61e
2 changed files with 12 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# Start configuration # Start configuration
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(app4triqs CXX) project(app4triqs VERSION 2.2.0 LANGUAGES CXX)
if(POLICY CMP0074) if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
endif() endif()
@ -47,12 +47,8 @@ endif()
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
# Define the app4triqs version numbers and get the git hash # Define the app4triqs version numbers and get the git hash
set(APP4TRIQS_VERSION_MAJOR 2)
set(APP4TRIQS_VERSION_MINOR 2)
set(APP4TRIQS_VERSION_PATCH 0)
set(APP4TRIQS_VERSION ${APP4TRIQS_VERSION_MAJOR}.${APP4TRIQS_VERSION_MINOR}.${APP4TRIQS_VERSION_PATCH})
triqs_get_git_hash_of_source_dir(APP4TRIQS_GIT_HASH) triqs_get_git_hash_of_source_dir(APP4TRIQS_GIT_HASH)
message(STATUS "app4triqs version : ${APP4TRIQS_VERSION}") message(STATUS "app4triqs version : ${PROJECT_VERSION}")
message(STATUS "Git hash: ${APP4TRIQS_GIT_HASH}") message(STATUS "Git hash: ${APP4TRIQS_GIT_HASH}")
# Build and install the app4triqs library # Build and install the app4triqs library
@ -92,12 +88,12 @@ if(BUILD_DEBIAN_PACKAGE)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging") message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging")
endif() endif()
SET(CPACK_GENERATOR "DEB") set(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_VERSION ${APP4TRIQS_VERSION}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
SET(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/app4triqs") set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/app4triqs")
EXECUTE_PROCESS(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.2)") set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.2)")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
INCLUDE(CPack) include(CPack)
endif() endif()

View File

@ -7,7 +7,7 @@ if(NOT APP4TRIQS_FOUND)
set(APP4TRIQS_FOUND True) set(APP4TRIQS_FOUND True)
# version # version
set(APP4TRIQS_VERSION @APP4TRIQS_VERSION@) set(APP4TRIQS_VERSION @PROJECT_VERSION@)
set(APP4TRIQS_GIT_HASH @APP4TRIQS_GIT_HASH@) set(APP4TRIQS_GIT_HASH @APP4TRIQS_GIT_HASH@)
# Root of the installation # Root of the installation
@ -16,7 +16,7 @@ set(APP4TRIQS_ROOT @CMAKE_INSTALL_PREFIX@)
# Include the exported targets of this project # Include the exported targets of this project
include(@CMAKE_INSTALL_PREFIX@/lib/cmake/app4triqs/app4triqs-targets.cmake) include(@CMAKE_INSTALL_PREFIX@/lib/cmake/app4triqs/app4triqs-targets.cmake)
message(STATUS "Found app4triqs-config.cmake with version ${APP4TRIQS_VERSION}, hash = ${APP4TRIQS_GIT_HASH}") message(STATUS "Found app4triqs-config.cmake with version @PROJECT_VERSION@, hash = @APP4TRIQS_GIT_HASH@")
# Was the Project built with Documentation? # Was the Project built with Documentation?
set(APP4TRIQS_WITH_DOCUMENTATION @Build_Documentation@) set(APP4TRIQS_WITH_DOCUMENTATION @Build_Documentation@)