summaryrefslogtreecommitdiff
path: root/infrastructure/cmake
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2017-02-27 21:57:41 +0000
committerChris Wilson <chris+github@qwirx.com>2018-03-08 22:20:47 +0000
commit4a9c1e9f305ae4317cdd05d2641db2da86eef615 (patch)
tree1d7313772efe8ab9969af4f542c1dba1cd3393b2 /infrastructure/cmake
parent9f53912f0967a4077c8c41f80d6d52b15b007a4c (diff)
Add support for M4 CXX flag detection in CMakeLists
Enables all flags that are detected by M4 builds to be detected by CMake builds as well (except for -Wall which enables a bunch of junk). (cherry picked from commit 2ea8a9706d79a386729c7b2d814089e90bac6926) (cherry picked from commit c6038419372534dba578da0c1b506bebc64f8f67)
Diffstat (limited to 'infrastructure/cmake')
-rw-r--r--infrastructure/cmake/CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/infrastructure/cmake/CMakeLists.txt b/infrastructure/cmake/CMakeLists.txt
index a00e10d7..e6f46148 100644
--- a/infrastructure/cmake/CMakeLists.txt
+++ b/infrastructure/cmake/CMakeLists.txt
@@ -478,7 +478,7 @@ move_file_if_exists(
"${boxconfig_cmake_h_dir}/BoxConfig.cmake.h.bak")
foreach(m4_filename boxbackup_tests.m4 ax_check_mount_point.m4 ax_func_syscall.m4)
- file(STRINGS "${base_dir}/infrastructure/m4/${m4_filename}" m4_functions REGEX "^ *AC[_A-Z]+\\(.*\\)$")
+ file(STRINGS "${base_dir}/infrastructure/m4/${m4_filename}" m4_functions REGEX "^ *(AC|AX|BOX)_[A-Z_]+\\(.*\\)$")
foreach(m4_function ${m4_functions})
if(DEBUG)
message(STATUS "Processing m4_function: ${m4_function}")
@@ -560,6 +560,22 @@ foreach(m4_filename boxbackup_tests.m4 ax_check_mount_point.m4 ax_func_syscall.m
}
]=] "HAVE_${platform_var_name}")
file(APPEND "${boxconfig_h_file}" "#cmakedefine HAVE_${platform_var_name}\n")
+ elseif(m4_function MATCHES "^ *BOX_CHECK_CXX_FLAG\\((-[A-Za-z_,=-]+)\\)")
+ if(DEBUG)
+ message(STATUS "Processing BOX_CHECK_CXX_FLAG: ${CMAKE_MATCH_1}")
+ endif()
+
+ if(NOT CMAKE_MATCH_1 STREQUAL "-Wall")
+ set(flag "${CMAKE_MATCH_1}")
+ string(TOLOWER "have_flag_${flag}" have_flag_var_name)
+ string(REGEX REPLACE "[^a-z_]" "_" have_flag_var_name ${have_flag_var_name})
+ string(REGEX REPLACE "__+" "_" have_flag_var_name ${have_flag_var_name})
+
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have_flag_var_name})
+ if(${have_flag_var_name})
+ add_definitions("${flag}")
+ endif()
+ endif()
endif()
endforeach()