Fixes to CMake and errmsg.sys file searching with custom file locations.

This commit is contained in:
Markus Makela 2014-11-21 14:15:14 +02:00
parent f59dfa85ea
commit 7dc0776346

View File

@ -115,14 +115,24 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
# Find the errmsg.sys file if it was not defied
if( DEFINED ERRMSG )
debugmsg("Looking for errmsg.sys at: ${ERRMSG}")
if(NOT(IS_DIRECTORY ${ERRMSG}))
get_filename_component(ERRMSG ${ERRMSG} PATH)
debugmsg("Path to file is: ${ERRMSG}")
endif()
find_file(ERRMSG_FILE errmsg.sys PATHS ${ERRMSG} NO_DEFAULT_PATH)
endif()
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english)
if(${ERRMSG_FILE} MATCHES "ERRMSG_FILE-NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found at ${ERRMSG}")
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
endif()
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english)
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
endif()
endif()
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
unset(ERRMSG_FILE)