From 7dc0776346d6a9edee038439f7cb5454fd177cea Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 21 Nov 2014 14:15:14 +0200 Subject: [PATCH] Fixes to CMake and errmsg.sys file searching with custom file locations. --- macros.cmake | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/macros.cmake b/macros.cmake index 672d20419..e9658a7a7 100644 --- a/macros.cmake +++ b/macros.cmake @@ -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=") + 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=") + 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)