From b0bb95d61eeff01c98b912ae0a793091a12bb960 Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Wed, 26 Jun 2019 11:35:20 -0400 Subject: [PATCH] [cmake] Use PROJECT_VERSION as defined through project(..) over APP4TRIQS_VERSION --- CMakeLists.txt | 24 ++++++++++-------------- share/cmake/app4triqs-config.cmake.in | 4 ++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cb817a1..b6fb593e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Start configuration cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) -project(app4triqs CXX) +project(app4triqs VERSION 2.2.0 LANGUAGES CXX) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() @@ -47,12 +47,8 @@ endif() message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------") # 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) -message(STATUS "app4triqs version : ${APP4TRIQS_VERSION}") +message(STATUS "app4triqs version : ${PROJECT_VERSION}") message(STATUS "Git hash: ${APP4TRIQS_GIT_HASH}") # Build and install the app4triqs library @@ -92,12 +88,12 @@ if(BUILD_DEBIAN_PACKAGE) if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr") message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging") endif() - SET(CPACK_GENERATOR "DEB") - SET(CPACK_PACKAGE_VERSION ${APP4TRIQS_VERSION}) - 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) - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.2)") - SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) - SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) - INCLUDE(CPack) + set(CPACK_GENERATOR "DEB") + set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + 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) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 2.2)") + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) + include(CPack) endif() diff --git a/share/cmake/app4triqs-config.cmake.in b/share/cmake/app4triqs-config.cmake.in index cc0c253c..7490c377 100644 --- a/share/cmake/app4triqs-config.cmake.in +++ b/share/cmake/app4triqs-config.cmake.in @@ -7,7 +7,7 @@ if(NOT APP4TRIQS_FOUND) set(APP4TRIQS_FOUND True) # version -set(APP4TRIQS_VERSION @APP4TRIQS_VERSION@) +set(APP4TRIQS_VERSION @PROJECT_VERSION@) set(APP4TRIQS_GIT_HASH @APP4TRIQS_GIT_HASH@) # Root of the installation @@ -16,7 +16,7 @@ set(APP4TRIQS_ROOT @CMAKE_INSTALL_PREFIX@) # Include the exported targets of this project 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? set(APP4TRIQS_WITH_DOCUMENTATION @Build_Documentation@)