mariadb/cmake/abi_check.cmake
Davi Arnaut 3ff34a4a32 Bug#52514: mysql 5.1 do_abi_check does not compile w/ gcc4.5
due to GCC preprocessor change
      
Addendum for trunk: add -DMYSQL_ABI_CHECK to the cmake ABI check.
2010-07-20 16:53:39 -03:00

56 lines
2 KiB
CMake

# Copyright (C) 2009 Sun Microsystems, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Headers which need to be checked for abi/api compatibility are in
# API_PREPROCESSOR_HEADER.
#
# We use gcc specific preprocessing command and sed/diff, so it will
# only be run on Unix and only if gcc is used.
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_C_COMPILER MATCHES "ccache$")
SET(COMPILER ${CMAKE_C_COMPILER_ARG1})
STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER})
ELSE()
SET(COMPILER ${CMAKE_C_COMPILER})
ENDIF()
SET(API_PREPROCESSOR_HEADER
${CMAKE_SOURCE_DIR}/include/mysql/plugin.h
${CMAKE_SOURCE_DIR}/include/mysql.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
)
ADD_CUSTOM_TARGET(abi_check ALL
COMMAND ${CMAKE_COMMAND}
-DCOMPILER=${COMPILER}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
"-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ADD_CUSTOM_TARGET(abi_check_all
COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER=${COMPILER}
-DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
"-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
VERBATIM
)
ENDIF()