Fixed changing cached values causing linking errors

This commit is contained in:
Markus Makela
2014-09-16 17:14:50 +03:00
parent e1118fb569
commit be057a4eef
2 changed files with 42 additions and 40 deletions

View File

@ -23,6 +23,7 @@ else()
message(STATUS "Dependencies ok") message(STATUS "Dependencies ok")
endif() endif()
check_dirs()
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/modules) set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/modules)

View File

@ -71,52 +71,53 @@ macro(check_deps)
message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}") message(FATAL_ERROR "Cannot find dependencies: ${FAILED_DEPS}")
endif() endif()
# Find the MySQL headers if they were not defined endmacro()
if(NOT ( DEFINED MYSQL_DIR ) )
find_path(MYSQL_DIR mysql.h PATH_SUFFIXES mysql mariadb) macro(check_dirs)
if(${MYSQL_DIR} STREQUAL "MYSQL_DIR-NOTFOUND") # Find the MySQL headers if they were not defined
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.") if(NOT ( DEFINED MYSQL_DIR ) )
endif() find_path(MYSQL_DIR mysql.h PATH_SUFFIXES mysql mariadb)
if(${MYSQL_DIR} STREQUAL "MYSQL_DIR-NOTFOUND")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
endif() endif()
endif()
# Find the errmsg.sys file if it was not defied # Find the errmsg.sys file if it was not defied
if( NOT ( DEFINED ERRMSG ) ) if( NOT ( DEFINED ERRMSG ) )
find_file(ERRMSG errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql ${CUSTOM_ERRMSG} PATH_SUFFIXES english) find_file(ERRMSG errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql ${CUSTOM_ERRMSG} PATH_SUFFIXES english)
if(${ERRMSG} STREQUAL "ERRMSG-NOTFOUND") if(${ERRMSG} STREQUAL "ERRMSG-NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.") message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.")
endif()
endif() endif()
endif()
# Find the embedded mysql library # Find the embedded mysql library
if( NOT ( DEFINED EMBEDDED_LIB ) ) if(STATIC_EMBEDDED)
if(STATIC_EMBEDDED) find_file(EMBEDDED_LIB_STATIC libmysqld.a PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_STATIC})
find_file(EMBEDDED_LIB libmysqld.a PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb) if(${EMBEDDED_LIB_STATIC} STREQUAL "EMBEDDED_LIB_STATIC-NOTFOUND")
if(${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB-NOTFOUND") message(WARNING "Warning: Static library not found, looking for dynamic version")
find_library(EMBEDDED_LIB_DYNAMIC mysqld PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
message(WARNING "Warning: Static library not found, looking for dynamic version") set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC})
find_library(EMBEDDED_LIB mysqld PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
endif()
endif()
else() else()
find_library(EMBEDDED_LIB mysqld PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb) find_library(EMBEDDED_LIB_DYNAMIC mysqld PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC})
endif() endif()
endif()
# Inform the user about the embedded library # Inform the user about the embedded library
if(${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB-NOTFOUND") 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=<path to library>") 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=<path to library>")
else() else()
get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH) get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH)
message(STATUS "Using embedded library: ${EMBEDDED_LIB}") message(STATUS "Using embedded library: ${EMBEDDED_LIB}")
endif() endif()
set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.") set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.")
endmacro() endmacro()