diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2015-03-05 13:03:47 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2015-03-05 13:54:10 +0100 |
commit | 939b3d97eea386216e9c1d45e20f3676be5ae8c6 (patch) | |
tree | 14de93ab9d41bdcfbb66e4166dfb4cc10570f0c2 | |
parent | add6b4f554f0246ed886a3cdd3f50cb1a54494e0 (diff) | |
download | dbus-939b3d97eea386216e9c1d45e20f3676be5ae8c6.tar.gz |
Add check to cmake build system if config.h.cmake is in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | cmake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/modules/MacrosAutotools.cmake | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 8c006d00..14685da2 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -17,7 +17,7 @@ endif(COMMAND cmake_policy) include(MacrosAutotools) autoinit(../configure.ac) autoversion(dbus) -autoheaderchecks(../config.h.in ConfigureChecks.cmake) +autoheaderchecks(../config.h.in ConfigureChecks.cmake config.h.cmake) # used by file version info set (DBUS_PATCH_VERSION "0") diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake index fac94a11..89828e05 100644 --- a/cmake/modules/MacrosAutotools.cmake +++ b/cmake/modules/MacrosAutotools.cmake @@ -116,30 +116,36 @@ macro(autodefine name) endforeach() endmacro() -macro(autoheaderchecks config_h_in configure_checks_file) +macro(autoheaderchecks config_h_in configure_checks_file config_h_cmake) 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}) + file(READ ${config_h_in} _config_h_in_raw) + file(READ ${config_h_cmake} _config_h_cmake_raw) + STRING(REGEX REPLACE ";" "\\\\;" _config_h_in "${_config_h_in_raw}") + STRING(REGEX REPLACE "\n" ";" _config_h_in "${_config_h_in}") + foreach(line ${_config_h_in}) #message(STATUS ${line}) if(line MATCHES ".*HAVE_.*_H.*") string (REGEX REPLACE ".*HAVE_(.*)_H.*" "\\1" key ${line}) + set(full_key "HAVE_${key}_H") 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)") + set(check "check_include_file(${dirname}/${filename}.h ${full_key})") + set(config_define "#cmakedefine ${full_key}") else() set(file ${key}) string(TOLOWER ${file} filename) - set(check "check_include_file(${filename}.h HAVE_${key}_H)") + set(check "check_include_file(${filename}.h ${full_key})") + set(config_define "#cmakedefine ${full_key}") endif() - set(full_key "HAVE_${key}_H") if(NOT configure_checks_file_raw MATCHES ".*${full_key}.*") message("${check}") endif() + if(NOT _config_h_cmake_raw MATCHES "${full_key}") + message("${config_define}") + endif() endif() endforeach() endmacro(autoheaderchecks) |