From 254b1bf05d5f6bd18cbfd2db506ced62bbfc9ae1 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 16 Apr 2015 18:11:29 +0300 Subject: [PATCH] Added FindPCRE.cmake which is used by the FindMySQL.cmake. --- .../Building-MaxScale-from-Source-Code.md | 5 +++++ cmake/FindMySQL.cmake | 9 +++++++-- cmake/FindPCRE.cmake | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 cmake/FindPCRE.cmake diff --git a/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md b/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md index 7459d25a4..30a06fcdb 100644 --- a/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md +++ b/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md @@ -259,3 +259,8 @@ When you run the `make testall` target after configuring the build with CMake a After testing has finished you can find a full testlog generated by CTest in `Testing/Temporary/` directory and MaxScale's log files in the `log/` directory of the build root. +## Building the MaxScale package + +First make sure you have the required libraries for your platform, including either rpmbuild for RHEL variants or dpkg-dev for Debian variants. + +If you wish to generate your own MaxScale package, you can do so by first configuring CMake with -DPACKAGE=Y. This will enable the package building target, `package` for the Makefile build system. After configuring, it should be as simple as running the `make package` command in the build directory. This will result in two packages, a tar.gz package and either a .rpm package or a .deb package depending on your system. diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index 7af6957a6..7aba9225b 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -91,8 +91,13 @@ check_library_exists(${EMBEDDED_LIB} pcre_stack_guard ${EMBEDDED_LIB} HAVE_EMBED if(HAVE_EMBEDDED_PCRE) set(PCRE_LINK_FLAGS "" CACHE INTERNAL "pcre linker flags") else() - message(STATUS "Embedded mysqld does not have pcre_stack_guard, linking with system pcre.") - set(PCRE_LINK_FLAGS "pcre" CACHE INTERNAL "pcre linker flags") + find_package(PCRE) + if(PCRE_FOUND) + set(PCRE_LINK_FLAGS "pcre" CACHE INTERNAL "pcre linker flags") + message(STATUS "Embedded mysqld does not have pcre_stack_guard, linking with system pcre.") + else() + message(FATAL_ERROR "Could not find PCRE libraries.") + endif() endif() if( (${EMBEDDED_LIB} MATCHES "NOTFOUND") OR (${EMBEDDED_LIB} MATCHES "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=") diff --git a/cmake/FindPCRE.cmake b/cmake/FindPCRE.cmake new file mode 100644 index 000000000..f4be2fe73 --- /dev/null +++ b/cmake/FindPCRE.cmake @@ -0,0 +1,15 @@ +# This CMake file tries to find the Perl regular expression libraries +# The following variables are set: +# PCRE_FOUND - System has the PCRE library +# PCRE_LIBRARIES - The PCRE library file +# PCRE_INCLUDE_DIRS - The folder with the PCRE headers + +find_library(PCRE_LIBRARIES NAMES pcre) +find_path(PCRE_INCLUDE_DIRS pcre.h) +if(PCRE_LIBRARIES AND PCRE_INCLUDE_DIRS) + message(STATUS "PCRE libs: ${PCRE_LIBRARIES}") + message(STATUS "PCRE include directory: ${PCRE_INCLUDE_DIRS}") + set(PCRE_FOUND TRUE CACHE INTERNAL "Found PCRE libraries") +else() + message(STATUS "PCRE not found") +endif()