From be2d05a4bc0f168753c6744432f3dc94da0cb16d Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 9 Apr 2018 22:20:38 +0200
Subject: [PATCH] cmake: Print module versions in summary
Makes helping with build issues easier as we readily see what versions
are being used.
Cmake already prints the version but only when run the first time and
not on subsequent calls, so the information is often lost
---
cmake/common/utils.cmake | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cmake/common/utils.cmake b/cmake/common/utils.cmake
index a2cb3d92..4c4010ef 100644
--- a/cmake/common/utils.cmake
+++ b/cmake/common/utils.cmake
@@ -13,6 +13,13 @@ endfunction()
# colored_option {{{
function(colored_option text flag)
+ # Append version of option, if ${flag}_VERSION is set
+ set(version ${${flag}_VERSION})
+
+ if(NOT "${version}" STREQUAL "")
+ set(text "${text} (${version})")
+ endif()
+
if(${flag})
message_colored(STATUS "[X]${text}" "32;1")
else()
@@ -233,6 +240,9 @@ function(querylib flag type pkg out_library out_include_dirs)
elseif(${type} STREQUAL "pkg-config")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PKG_${flag} REQUIRED ${pkg})
+
+ # Set packet version so that it can be used in the summary
+ set(${flag}_VERSION ${PKG_${flag}_VERSION} PARENT_SCOPE)
list(APPEND ${out_library} ${PKG_${flag}_LIBRARIES})
list(APPEND ${out_include_dirs} ${PKG_${flag}_INCLUDE_DIRS})
else()