aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-08-31 17:38:57 +0200
committerDamjan Marion <damarion@cisco.com>2018-08-31 21:14:29 +0200
commitc6c0246e2e9219baee3d67970775bed7560eac1e (patch)
treed8fb787aa3e95c30442e8fc997d05b6cdc4a008e /src/CMakeLists.txt
parent219cc90cb435cfcfb5154c6c0e49bd4d60aae769 (diff)
cmake: detect vpp version, set soversion, pretty config print
Change-Id: I5d0777421debe6c3e4b93d62ad6790912063a9e6 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3d934f26459..c5dfca20b92 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,12 +16,23 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(vpp C)
include(CheckCCompilerFlag)
-
include(cmake/message.cmake)
include(cmake/cpu.cmake)
include(cmake/ccache.cmake)
##############################################################################
+# VPP Version
+##############################################################################
+execute_process(
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND scripts/version
+ OUTPUT_VARIABLE VPP_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+string(REPLACE "-" ";" VPP_LIB_VERSION ${VPP_VERSION})
+list(GET VPP_LIB_VERSION 0 VPP_LIB_VERSION)
+
+##############################################################################
# build config
##############################################################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@@ -41,10 +52,6 @@ endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${VPP_LIB_DIR_NAME}")
set(CMAKE_INSTALL_MESSAGE NEVER)
-message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
-message(STATUS "We are on a ${CMAKE_SYSTEM_NAME} system")
-message(STATUS "The host processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
-
include_directories (
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
@@ -74,3 +81,32 @@ foreach(
endforeach()
include(cmake/pack.cmake)
+##############################################################################
+# detect if we are inside git repo and add configure dependency
+##############################################################################
+execute_process(
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND git rev-parse --show-toplevel
+ OUTPUT_VARIABLE VPP_GIT_TOPLEVEL_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+if (VPP_GIT_TOPLEVEL_DIR)
+ set_property(
+ DIRECTORY APPEND PROPERTY
+ CMAKE_CONFIGURE_DEPENDS ${VPP_GIT_TOPLEVEL_DIR}/.git/index
+ )
+endif()
+
+##############################################################################
+# print configuration
+##############################################################################
+message(STATUS "Configuration:")
+pr("VPP version" "${VPP_VERSION}")
+pr("VPP library version" "${VPP_LIB_VERSION}")
+pr("GIT toplevel dir" "${VPP_GIT_TOPLEVEL_DIR}")
+pr("C flags" "${CMAKE_C_FLAGS}")
+pr("Linker flags" "${CMAKE_LINKER_FLAGS}")
+pr("Target processor" "${CMAKE_SYSTEM_PROCESSOR}")
+pr("Build type" "${CMAKE_BUILD_TYPE}")
+pr("Install prefix" "${CMAKE_INSTALL_PREFIX}")