diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2015-03-05 09:01:31 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2015-03-05 13:52:57 +0100 |
commit | 4d8a27701ba8f278ea61f513218dac1af3b7e589 (patch) | |
tree | 9bbe3a6932f48100b55cc6133b0880de357d84ef /cmake/modules | |
parent | 8696bfdf07a65f1887a907db869f8986fd21a40a (diff) | |
download | dbus-4d8a27701ba8f278ea61f513218dac1af3b7e589.tar.gz |
Add cmake macro autoheaderchecks().
This macro prints out any include file defined as HAVE_..._H in the config
header template and not in the related cmake configure checks file.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/MacrosAutotools.cmake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake index a218db9a..fac94a11 100644 --- a/cmake/modules/MacrosAutotools.cmake +++ b/cmake/modules/MacrosAutotools.cmake @@ -116,6 +116,34 @@ macro(autodefine name) endforeach() endmacro() +macro(autoheaderchecks config_h_in configure_checks_file) + file(READ ${configure_checks_file} configure_checks_file_raw) + file(READ ${config_h_in} _config_h_raw) + STRING(REGEX REPLACE ";" "\\\\;" _config_h "${_config_h_raw}") + STRING(REGEX REPLACE "\n" ";" _config_h "${_config_h}") + foreach(line ${_config_h}) + #message(STATUS ${line}) + if(line MATCHES ".*HAVE_.*_H.*") + string (REGEX REPLACE ".*HAVE_(.*)_H.*" "\\1" key ${line}) + if(key MATCHES ".*_.*") + string(REGEX MATCH "^[A-Z0-9]+" dir ${key}) + string(REGEX MATCH "[A-Z0-9]+$" file ${key}) + string(TOLOWER ${dir} dirname) + string(TOLOWER ${file} filename) + set(check "check_include_file(${dirname}/${filename}.h HAVE_${key}_H)") + else() + set(file ${key}) + string(TOLOWER ${file} filename) + set(check "check_include_file(${filename}.h HAVE_${key}_H)") + endif() + set(full_key "HAVE_${key}_H") + if(NOT configure_checks_file_raw MATCHES ".*${full_key}.*") + message("${check}") + endif() + endif() + endforeach() +endmacro(autoheaderchecks) + # # parses config.h template and create cmake equivalent # not implemented yet |