Closed s-yata closed 10 years ago
I've run CMake and gotten the following output. It seems that only the first check (-Wall for C compiler) is valid.
...
-- Performing Test is_available
-- Performing Test is_available - Success
-- checking for C flag '-Wall' - available
-- checking for CXX flag '-Wall' - available
-- checking for C flag '-Wextra' - available
-- checking for CXX flag '-Wextra' - available
-- checking for C flag '-Wno-unused-parameter' - available
-- checking for CXX flag '-Wno-unused-parameter' - available
-- checking for C flag '-Wno-strict-aliasing' - available
-- checking for CXX flag '-Wno-strict-aliasing' - available
-- checking for C flag '-Wno-deprecated' - available
-- checking for CXX flag '-Wno-deprecated' - available
-- checking for CXX flag '-fno-implicit-templates' - available
-- checking for CXX flag '-fno-exceptions' - available
-- checking for CXX flag '-fno-rtti' - available
-- checking for CXX flag '-felide-constructors' - available
...
As explained in #22, we feel that "Performing Test HAVE_-Wno-clobbered" is strange. We prefer "Performing Test CXXFLAG_WNO_CLOBBERED" (Groonga style).
Output of CMake changed as follows:
...
-- Performing Test CFLAG_WALL
-- Performing Test CFLAG_WALL - Success
-- Performing Test CXXFLAG_WALL
-- Performing Test CXXFLAG_WALL - Success
-- Performing Test CFLAG_WEXTRA
-- Performing Test CFLAG_WEXTRA - Success
-- Performing Test CXXFLAG_WEXTRA
-- Performing Test CXXFLAG_WEXTRA - Success
-- Performing Test CFLAG_WNO_UNUSED_PARAMETER
-- Performing Test CFLAG_WNO_UNUSED_PARAMETER - Success
-- Performing Test CXXFLAG_WNO_UNUSED_PARAMETER
-- Performing Test CXXFLAG_WNO_UNUSED_PARAMETER - Success
-- Performing Test CFLAG_WNO_STRICT_ALIASING
-- Performing Test CFLAG_WNO_STRICT_ALIASING - Success
-- Performing Test CXXFLAG_WNO_STRICT_ALIASING
-- Performing Test CXXFLAG_WNO_STRICT_ALIASING - Success
-- Performing Test CFLAG_WNO_DEPRECATED
-- Performing Test CFLAG_WNO_DEPRECATED - Success
-- Performing Test CXXFLAG_WNO_DEPRECATED
-- Performing Test CXXFLAG_WNO_DEPRECATED - Success
-- Performing Test CXXFLAG_FNO_IMPLICIT_TEMPLATES
-- Performing Test CXXFLAG_FNO_IMPLICIT_TEMPLATES - Success
-- Performing Test CXXFLAG_FNO_EXCEPTIONS
-- Performing Test CXXFLAG_FNO_EXCEPTIONS - Success
-- Performing Test CXXFLAG_FNO_RTTI
-- Performing Test CXXFLAG_FNO_RTTI - Success
-- Performing Test CXXFLAG_FELIDE_CONSTRUCTORS
-- Performing Test CXXFLAG_FELIDE_CONSTRUCTORS - Success
...
Description
Checks for C/C++ compiler flags are skipped in CMake.
This is because the same variable "is_available" is used for all checks. check_c/cxx_compiler_flag() skips a check when "is_available" is already set. This means that only the first check is valid.
The original comment is as follows:
Solution
MariaDB developers also gave us a comment as follows:
I found an example in mariadb-10.1.0/cmake/check_compiler_flag.cmake. MariaDB-10.1.0 uses HAVEC/CXX*.
We can use the same variable names to skip checks for C/C++ compiler flags.