From d548d74beed112ede288723da42683b5ecb0daea Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Mon, 22 Sep 2014 15:26:24 +0300 Subject: [PATCH] fixed some variables being compared to the wrong string --- README | 5 +++++ macros.cmake | 32 +++++++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/README b/README index 3affd5b85..e44ccfd09 100644 --- a/README +++ b/README @@ -195,6 +195,11 @@ If you have your headers and libraries in non-standard locations, you can define By default, MaxScale installs to '/usr/local/skysql/maxscale' and places init.d scripts and ldconfig files into their folders. Change the INSTALL_DIR variable to your desired installation directory and set INSTALL_SYSTEM_FILES=N to prevent the init.d script and ldconfig file installation. +If you run into any trouble while configuring CMake, you can always remove the 'CMakeCache.txt' file to clear CMake's +internal cache. This resets all values to their defaults and can be used to fix a 'stuck' configuration of CMake. This +is also a good reason why you should always build into a separate directory, because you can safely wipe the build directory clean without the +danger of deleting important files. + All the parameters affecting CMake can be found in 'macros.cmake'. This file also has the parameters CMake uses for testing. All the variables that control the CMake build process: diff --git a/macros.cmake b/macros.cmake index 7c5109925..d5e87ae48 100644 --- a/macros.cmake +++ b/macros.cmake @@ -69,28 +69,30 @@ macro(check_deps) endforeach() if(DEPS_ERROR) - message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}") endif() endmacro() macro(check_dirs) + # Find the MySQL headers if they were not defined if(DEFINED MYSQL_DIR) message(STATUS "Searching for MySQL headers at: ${MYSQL_DIR}") find_path(MYSQL_DIR_LOC mysql.h PATHS ${MYSQL_DIR} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH) - else() - find_path(MYSQL_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb) endif() + find_path(MYSQL_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb) message(STATUS "Search returned: ${MYSQL_DIR_LOC}") - set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE) - if(${MYSQL_DIR} STREQUAL "MYSQL_DIR-NOTFOUND") - message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") + + if(${MYSQL_DIR_LOC} STREQUAL "MYSQL_DIR_LOC-NOTFOUND") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") else() message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}") + set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE) endif() + set(MYSQL_DIR_LOC "" INTERNAL) # Find the errmsg.sys file if it was not defied if( DEFINED ERRMSG ) @@ -98,12 +100,13 @@ macro(check_dirs) 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") - message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=") 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() set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE) + set(ERRMSG_FILE "" INTERNAL) # Find the embedded mysql library if(STATIC_EMBEDDED) @@ -119,12 +122,12 @@ macro(check_dirs) message(STATUS "Search returned: ${EMBEDDED_LIB_STATIC}") set(EMBEDDED_LIB ${EMBEDDED_LIB_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE) set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES}) + set(OLD_SUFFIXES "" INTERNAL) else() if (DEFINED EMBEDDED_LIB) message(STATUS "Searching for libmysqld.so at: ${EMBEDDED_LIB}") find_library(EMBEDDED_LIB_DYNAMIC mysqld PATHS ${EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH) - else() find_library(EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb) endif() @@ -132,12 +135,13 @@ macro(check_dirs) set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE) endif() - + set(EMBEDDED_LIB_DYNAMIC "" INTERNAL) + set(EMBEDDED_LIB_STATIC "" INTERNAL) # Inform the user about the embedded library if( (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_STATIC-NOTFOUND") OR (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_DYNAMIC-NOTFOUND")) - message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DEMBEDDED_LIB=") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DEMBEDDED_LIB=") else() get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH) message(STATUS "Using embedded library: ${EMBEDDED_LIB}") @@ -149,14 +153,16 @@ macro(check_dirs) if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND") find_file(DEB_FNC init-functions PATHS /lib/lsb) if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND") - message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.") else() set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.") endif() else() set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.") endif() + set(DEB_FNC "" INTERNAL) + set(RPM_FNC "" INTERNAL) #Check RabbitMQ headers and libraries if(BUILD_RABBITMQ) @@ -166,8 +172,8 @@ macro(check_dirs) endif() find_library(RMQ_LIB rabbitmq) if(RMQ_LIB STREQUAL "RMQ_LIB-NOTFOUND") - message(FATAL_ERROR "Cannot find RabbitMQ libraries, please define the path to the libraries with -DRABBITMQ_LIB=") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Cannot find RabbitMQ libraries, please define the path to the libraries with -DRABBITMQ_LIB=") else() set(RABBITMQ_LIB ${RMQ_LIB} CACHE PATH "Path to RabbitMQ libraries" FORCE) message(STATUS "Using RabbitMQ libraries found at: ${RABBITMQ_LIB}") @@ -178,8 +184,8 @@ macro(check_dirs) endif() find_file(RMQ_HEADERS amqp.h) if(RMQ_HEADERS STREQUAL "RMQ_HEADERS-NOTFOUND") - message(FATAL_ERROR "Cannot find RabbitMQ headers, please define the path to the headers with -DRABBITMQ_HEADERS=") set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.") + message(FATAL_ERROR "Cannot find RabbitMQ headers, please define the path to the headers with -DRABBITMQ_HEADERS=") else() set(RABBITMQ_HEADERS ${RMQ_HEADERS} CACHE PATH "Path to RabbitMQ headers" FORCE) message(STATUS "Using RabbitMQ headers found at: ${RABBITMQ_HEADERS}")