*** FindMySQL.cmake Tue Sep 27 02:21:28 2016 --- FindMySQL.cmake.ORI Tue Sep 27 02:18:16 2016 *************** *** 22,28 **** # MYSQL_DIR - Set in environment or as parameter to "cmake", # this is the top directory of the MySQL Server or # Connector/C install ! # MYSQL_SOURCE_INCLUDE_DIR - Set in environment or as parameter to "cmake", # this is the include directory where to find # the client library # MYSQL_LIB_DIR - Set in environment or as parameter to "cmake", --- 22,28 ---- # MYSQL_DIR - Set in environment or as parameter to "cmake", # this is the top directory of the MySQL Server or # Connector/C install ! # MYSQL_INCLUDE_DIR - Set in environment or as parameter to "cmake", # this is the include directory where to find # the client library # MYSQL_LIB_DIR - Set in environment or as parameter to "cmake", *************** *** 57,63 **** # MYSQL_LIBRARIES - Library name, might be "-lmysqlclient" while # MYSQL_LIB is the path to the library # ! # (1) If MYSQL_SOURCE_INCLUDE_DIR or MYSQL_LIB_DIR are given, these are # used and an error is reported if can't be used # (2) If MYSQL_CONFIG_EXECUTABLE is given, it is used to get # headers and libraries --- 57,63 ---- # MYSQL_LIBRARIES - Library name, might be "-lmysqlclient" while # MYSQL_LIB is the path to the library # ! # (1) If MYSQL_INCLUDE_DIR or MYSQL_LIB_DIR are given, these are # used and an error is reported if can't be used # (2) If MYSQL_CONFIG_EXECUTABLE is given, it is used to get # headers and libraries *************** *** 97,103 **** set(ENV_OR_OPT_VARS MYSQL_DIR ! MYSQL_SOURCE_INCLUDE_DIR MYSQL_LIB_DIR MYSQL_CFLAGS MYSQL_CXXFLAGS --- 97,103 ---- set(ENV_OR_OPT_VARS MYSQL_DIR ! MYSQL_INCLUDE_DIR MYSQL_LIB_DIR MYSQL_CFLAGS MYSQL_CXXFLAGS *************** *** 112,118 **** # Mark the variable names that have values that are paths set(ENV_OR_OPT_PATH_VARS MYSQL_DIR ! MYSQL_SOURCE_INCLUDE_DIR MYSQL_LIB_DIR ) --- 112,118 ---- # Mark the variable names that have values that are paths set(ENV_OR_OPT_PATH_VARS MYSQL_DIR ! MYSQL_INCLUDE_DIR MYSQL_LIB_DIR ) *************** *** 132,138 **** set(${_xvar} $ENV{${_xvar}}) endif() ! # Notmalize the path if the variable is set and is a path if(${_xvar}) list(FIND ENV_OR_OPT_PATH_VARS ${_xvar} _index) if (${_index} GREATER -1) --- 132,138 ---- set(${_xvar} $ENV{${_xvar}}) endif() ! # Notmalize the path if the variable is set and is a path if(${_xvar}) list(FIND ENV_OR_OPT_PATH_VARS ${_xvar} _index) if (${_index} GREATER -1) *************** *** 476,502 **** ########################################################################## # ! # Find MYSQL_SOURCE_INCLUDE_DIR # ########################################################################## ! if(FINDMYSQL_DEBUG AND MYSQL_SOURCE_INCLUDE_DIR) ! message("DBG: User gave MYSQL_SOURCE_INCLUDE_DIR = \"${MYSQL_SOURCE_INCLUDE_DIR}\"") endif() if(FINDMYSQL_DEBUG AND MYSQL_DIR) message("DBG: User gave MYSQL_DIR = \"${MYSQL_DIR}\"") endif() ! if(MYSQL_SOURCE_INCLUDE_DIR) if(FINDMYSQL_DEBUG) ! message("DBG: Using MYSQL_SOURCE_INCLUDE_DIR to find \"mysql.h\"") endif() ! if(NOT EXISTS "${MYSQL_SOURCE_INCLUDE_DIR}/mysql.h") ! message(FATAL_ERROR "MYSQL_SOURCE_INCLUDE_DIR given, but no \"mysql.h\" " ! "in \"${MYSQL_SOURCE_INCLUDE_DIR}\"") endif() elseif(MYSQL_DIR AND --- 476,502 ---- ########################################################################## # ! # Find MYSQL_INCLUDE_DIR # ########################################################################## ! if(FINDMYSQL_DEBUG AND MYSQL_INCLUDE_DIR) ! message("DBG: User gave MYSQL_INCLUDE_DIR = \"${MYSQL_INCLUDE_DIR}\"") endif() if(FINDMYSQL_DEBUG AND MYSQL_DIR) message("DBG: User gave MYSQL_DIR = \"${MYSQL_DIR}\"") endif() ! if(MYSQL_INCLUDE_DIR) if(FINDMYSQL_DEBUG) ! message("DBG: Using MYSQL_INCLUDE_DIR to find \"mysql.h\"") endif() ! if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h") ! message(FATAL_ERROR "MYSQL_INCLUDE_DIR given, but no \"mysql.h\" " ! "in \"${MYSQL_INCLUDE_DIR}\"") endif() elseif(MYSQL_DIR AND *************** *** 507,516 **** message("DBG: Using MYSQL_DIR without \"mysql_config\" to find \"mysql.h\"") endif() ! set(MYSQL_SOURCE_INCLUDE_DIR "${MYSQL_DIR}/include") ! if(NOT EXISTS "${MYSQL_SOURCE_INCLUDE_DIR}/mysql.h") message(FATAL_ERROR "MYSQL_DIR given, but no \"mysql.h\" " ! "in \"${MYSQL_SOURCE_INCLUDE_DIR}\"") endif() elseif(MYSQL_CONFIG_EXECUTABLE) --- 507,516 ---- message("DBG: Using MYSQL_DIR without \"mysql_config\" to find \"mysql.h\"") endif() ! set(MYSQL_INCLUDE_DIR "${MYSQL_DIR}/include") ! if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h") message(FATAL_ERROR "MYSQL_DIR given, but no \"mysql.h\" " ! "in \"${MYSQL_INCLUDE_DIR}\"") endif() elseif(MYSQL_CONFIG_EXECUTABLE) *************** *** 521,534 **** # This code assumes there is just one "-I...." and that # no space between "-I" and the path ! _mysql_config(MYSQL_SOURCE_INCLUDE_DIR "(^| )-I" "--include") ! if(NOT MYSQL_SOURCE_INCLUDE_DIR) message(FATAL_ERROR "Could not find the include dir from running " "\"${MYSQL_CONFIG_EXECUTABLE}\"") endif() ! if(NOT EXISTS "${MYSQL_SOURCE_INCLUDE_DIR}/mysql.h") ! message(FATAL_ERROR "Could not find \"mysql.h\" in \"${MYSQL_SOURCE_INCLUDE_DIR}\" " "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") endif() --- 521,534 ---- # This code assumes there is just one "-I...." and that # no space between "-I" and the path ! _mysql_config(MYSQL_INCLUDE_DIR "(^| )-I" "--include") ! if(NOT MYSQL_INCLUDE_DIR) message(FATAL_ERROR "Could not find the include dir from running " "\"${MYSQL_CONFIG_EXECUTABLE}\"") endif() ! if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h") ! message(FATAL_ERROR "Could not find \"mysql.h\" in \"${MYSQL_INCLUDE_DIR}\" " "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") endif() *************** *** 547,558 **** "\"${_pp_include_fallback_path}\"") endif() ! get_filename_component(MYSQL_SOURCE_INCLUDE_DIR ${_found_header} PATH) endif() if(FINDMYSQL_DEBUG) ! message("DBG: MYSQL_SOURCE_INCLUDE_DIR = \"${MYSQL_SOURCE_INCLUDE_DIR}\"") endif() ########################################################################## --- 547,558 ---- "\"${_pp_include_fallback_path}\"") endif() ! get_filename_component(MYSQL_INCLUDE_DIR ${_found_header} PATH) endif() if(FINDMYSQL_DEBUG) ! message("DBG: MYSQL_INCLUDE_DIR = \"${MYSQL_INCLUDE_DIR}\"") endif() ########################################################################## *************** *** 582,588 **** set(MYSQL_LIBRARIES ${MYSQL_LIB}) elseif(MYSQL_DIR AND ! (NOT _mysql_config_in_mysql_dir) AND (NOT _mysql_config_set_by_user)) if(FINDMYSQL_DEBUG) --- 582,588 ---- set(MYSQL_LIBRARIES ${MYSQL_LIB}) elseif(MYSQL_DIR AND ! (NOT _mysql_config_in_mysql_dir) AND (NOT _mysql_config_set_by_user)) if(FINDMYSQL_DEBUG) *************** *** 618,624 **** endif() if(NOT EXISTS "${MYSQL_LIB_DIR}") ! message(FATAL_ERROR "Could not find the directory \"${MYSQL_SOURCE_INCLUDE_DIR}\" " "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") endif() --- 618,624 ---- endif() if(NOT EXISTS "${MYSQL_LIB_DIR}") ! message(FATAL_ERROR "Could not find the directory \"${MYSQL_INCLUDE_DIR}\" " "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") endif() *************** *** 715,721 **** # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MYSQL_CXXFLAGS}") # set(CMAKE_CXX_FLAGS_${CMAKEBT} "${CMAKE_CXX_FLAGS_${CMAKEBT}} ${MYSQL_CXXFLAGS}") ! include_directories(${MYSQL_SOURCE_INCLUDE_DIR}) link_directories(${MYSQL_LIB_DIR}) ########################################################################## --- 715,721 ---- # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MYSQL_CXXFLAGS}") # set(CMAKE_CXX_FLAGS_${CMAKEBT} "${CMAKE_CXX_FLAGS_${CMAKEBT}} ${MYSQL_CXXFLAGS}") ! include_directories(${MYSQL_INCLUDE_DIR}) link_directories(${MYSQL_LIB_DIR}) ########################################################################## *************** *** 727,733 **** message(STATUS "MySQL client environment/cmake variables set that the user can override") message(STATUS " MYSQL_DIR : ${MYSQL_DIR}") ! message(STATUS " MYSQL_SOURCE_INCLUDE_DIR : ${MYSQL_SOURCE_INCLUDE_DIR}") message(STATUS " MYSQL_LIB_DIR : ${MYSQL_LIB_DIR}") message(STATUS " MYSQL_CONFIG_EXECUTABLE : ${MYSQL_CONFIG_EXECUTABLE}") message(STATUS " MYSQL_CXX_LINKAGE : ${MYSQL_CXX_LINKAGE}") --- 727,733 ---- message(STATUS "MySQL client environment/cmake variables set that the user can override") message(STATUS " MYSQL_DIR : ${MYSQL_DIR}") ! message(STATUS " MYSQL_INCLUDE_DIR : ${MYSQL_INCLUDE_DIR}") message(STATUS " MYSQL_LIB_DIR : ${MYSQL_LIB_DIR}") message(STATUS " MYSQL_CONFIG_EXECUTABLE : ${MYSQL_CONFIG_EXECUTABLE}") message(STATUS " MYSQL_CXX_LINKAGE : ${MYSQL_CXX_LINKAGE}")