summaryrefslogtreecommitdiffstats
path: root/common/cmake
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2015-04-10 19:02:25 +0200
committerTimo Dritschler <timo.dritschler@kit.edu>2015-04-14 15:40:36 +0200
commitb0ffd9f0a5278f2ef81a267af3c8f72ab8d0f7c2 (patch)
treeef4ae05af135a850ec89b303a558af29e65c8284 /common/cmake
parentde68b48a1ff110e965f2c02fc930201ece9980d2 (diff)
downloadkiro-b0ffd9f0a5278f2ef81a267af3c8f72ab8d0f7c2.tar.gz
kiro-b0ffd9f0a5278f2ef81a267af3c8f72ab8d0f7c2.tar.bz2
kiro-b0ffd9f0a5278f2ef81a267af3c8f72ab8d0f7c2.tar.xz
kiro-b0ffd9f0a5278f2ef81a267af3c8f72ab8d0f7c2.zip
Heavily changed cmake build scripts
Added gi-introspection module to build chain
Diffstat (limited to 'common/cmake')
-rw-r--r--common/cmake/PkgConfigVars.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/cmake/PkgConfigVars.cmake b/common/cmake/PkgConfigVars.cmake
new file mode 100644
index 0000000..f295457
--- /dev/null
+++ b/common/cmake/PkgConfigVars.cmake
@@ -0,0 +1,30 @@
+# - determine variables defined in pkg-config files
+#
+# Usage:
+# pkg_check_variable(<PKG_NAME> <VARIABLE_NAME>)
+#
+# Checks for a variable in the given package and translates to a call such as
+# `pkg-config --variable=<VARIABLE_NAME> <PKG_NAME>`. The output is a cached
+# variable named
+#
+# <PKG_NAME>_<VARIABLE_NAME>
+#
+# Note that both names are uppercased and any dashes replaced by underscores.
+#
+
+find_package(PkgConfig REQUIRED)
+
+function(pkg_check_variable _pkg _name)
+ string(TOUPPER ${_pkg} _pkg_upper)
+ string(TOUPPER ${_name} _name_upper)
+ string(REPLACE "-" "_" _pkg_upper ${_pkg_upper})
+ string(REPLACE "-" "_" _name_upper ${_name_upper})
+ set(_output_name "${_pkg_upper}_${_name_upper}")
+
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg}
+ OUTPUT_VARIABLE _pkg_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable
+ ${_name} of ${_pkg}")
+endfunction()