summaryrefslogtreecommitdiff
path: root/storage/mroonga
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-09-01 21:58:10 +0200
committerSergei Golubchik <serg@mariadb.org>2015-09-04 10:32:02 +0200
commite74f91dfd7986a63e73e72b8a1fbeaa2822d8f1e (patch)
treea23f27c30e40dd58c1a7c6eb2c1ce89ab6826a8b /storage/mroonga
parentefbd4bb039060e9cc7a82467c36307367f4013ec (diff)
downloadmariadb-git-e74f91dfd7986a63e73e72b8a1fbeaa2822d8f1e.tar.gz
cmake: always use the same function to test for compiler flags
Fix all cmake tests (including plugin) to use MY_CHECK_AND_SET_COMPILER_FLAG. And fix that function to be compatible with cmake 3.0. This way flag checks are correctly cached (even in cmake 3.0) and properly reused.
Diffstat (limited to 'storage/mroonga')
-rw-r--r--storage/mroonga/CMakeLists.txt47
-rw-r--r--storage/mroonga/vendor/groonga/CMakeLists.txt69
2 files changed, 31 insertions, 85 deletions
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index 26f719c773e..9aa5a4bd990 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -132,31 +132,6 @@ include(${MRN_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)
set(MRN_C_COMPILE_FLAGS "")
set(MRN_CXX_COMPILE_FLAGS "")
-macro(mrn_check_cflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CFLAG${temporary_variable_name}")
- check_c_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(mrn_check_cxxflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
- check_cxx_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(mrn_build_flag flag)
- mrn_check_cflag(${flag})
- mrn_check_cxxflag(${flag})
-endmacro()
-
if(MRN_BUNDLED)
set(MRN_RELATIVE_DIR_PREFIX "${MRN_SOURCE_DIR}/")
else()
@@ -360,19 +335,15 @@ else()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
- mrn_build_flag("-Wall")
- mrn_build_flag("-Wextra")
- mrn_build_flag("-Wno-unused-parameter")
- mrn_build_flag("-Wno-strict-aliasing")
- mrn_build_flag("-Wno-deprecated")
- mrn_check_cxxflag("-fno-implicit-templates")
- if(("${MYSQL_VARIANT}" STREQUAL "MariaDB") OR
- ("${MYSQL_VARIANT}" STREQUAL "MySQL" AND
- ${MYSQL_VERSION} VERSION_LESS "5.7.0"))
- mrn_check_cxxflag("-fno-exceptions")
- mrn_check_cxxflag("-fno-rtti")
- endif()
- mrn_check_cxxflag("-felide-constructors")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-implicit-templates")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors")
endif()
set_source_files_properties(${MRN_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt
index ebe7f6b7fe5..e0652982e73 100644
--- a/storage/mroonga/vendor/groonga/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/CMakeLists.txt
@@ -143,59 +143,34 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
-macro(check_cflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CFLAG${temporary_variable_name}")
- check_c_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(GRN_C_COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(check_cxxflag flag)
- string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
- string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
- set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
- check_cxx_compiler_flag(${flag} ${temporary_variable_name})
- if(${temporary_variable_name})
- set(GRN_CXX_COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS} ${flag}")
- endif()
-endmacro()
-
-macro(check_build_flag flag)
- check_cflag(${flag})
- check_cxxflag(${flag})
-endmacro()
-
if(CMAKE_COMPILER_IS_GNUCXX)
- check_build_flag("-Wall")
- check_build_flag("-Wextra")
- check_build_flag("-Wno-unused-but-set-variable")
- check_build_flag("-Wno-unused-parameter")
- check_build_flag("-Wno-sign-compare")
- check_cflag("-Wno-pointer-sign")
- check_build_flag("-Wno-missing-field-initializers")
- check_build_flag("-Wformat=2")
- check_build_flag("-Wstrict-aliasing=2")
- check_build_flag("-fno-strict-aliasing")
- check_build_flag("-Wdisabled-optimization")
- check_build_flag("-Wfloat-equal")
- check_build_flag("-Wpointer-arith")
- check_cflag("-Wdeclaration-after-statement")
- check_cflag("-Wbad-function-cast")
- check_build_flag("-Wcast-align")
- # check_build_flag("-Wredundant-decls")
- check_build_flag("-Wwrite-strings")
- check_cxxflag("-fexceptions")
- check_cxxflag("-fimplicit-templates")
- check_build_flag("-Wno-clobbered")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-but-set-variable")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-sign-compare")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-pointer-sign")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-missing-field-initializers")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat=2")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wstrict-aliasing=2")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wdisabled-optimization")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wfloat-equal")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wpointer-arith")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wdeclaration-after-statement")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wbad-function-cast")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wcast-align")
+ #MY_CHECK_AND_SET_COMPILER_FLAG("-Wredundant-decls")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wwrite-strings")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fexceptions")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fimplicit-templates")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-clobbered")
endif()
if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
# For old CMake
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
- check_build_flag("-fPIC")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fPIC")
endif()
endif()