Commit a0114b86 authored by Sergei Golubchik's avatar Sergei Golubchik

cmake: don't repeat yourself

make repeated cmake runs less verbose:
* remove few not very useful MESSAGE's
* only run pkg_check_modules() if there's no cached result
* only print QQGraph messages on the first run
parent e74f91df
...@@ -147,7 +147,6 @@ MACRO (MYSQL_CHECK_SSL) ...@@ -147,7 +147,6 @@ MACRO (MYSQL_CHECK_SSL)
IF (WITH_SSL_PATH) IF (WITH_SSL_PATH)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF() ENDIF()
MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>")
FIND_LIBRARY(OPENSSL_LIBRARIES FIND_LIBRARY(OPENSSL_LIBRARIES
NAMES ssl ssleay32 ssleay32MD NAMES ssl ssleay32 ssleay32MD
HINTS ${OPENSSL_ROOT_DIR}/lib) HINTS ${OPENSSL_ROOT_DIR}/lib)
......
...@@ -48,7 +48,7 @@ IF(UNIX) ...@@ -48,7 +48,7 @@ IF(UNIX)
# Bar: -Wfatal-errors removed (does not present in gcc on solaris10) # Bar: -Wfatal-errors removed (does not present in gcc on solaris10)
if(WITH_WARNINGS) if(WITH_WARNINGS)
add_definitions(-Wall -Wextra -Wmissing-declarations) add_definitions(-Wall -Wextra -Wmissing-declarations)
message(STATUS "CONNECT: GCC: All warnings enabled") #message(STATUS "CONNECT: GCC: All warnings enabled")
else() else()
add_definitions(-Wall -Wmissing-declarations) add_definitions(-Wall -Wmissing-declarations)
add_definitions(-Wno-write-strings) add_definitions(-Wno-write-strings)
...@@ -69,7 +69,7 @@ IF(UNIX) ...@@ -69,7 +69,7 @@ IF(UNIX)
# These switches are for C++ only # These switches are for C++ only
# add_definitions(-Wno-reorder) # add_definitions(-Wno-reorder)
message(STATUS "CONNECT: GCC: Some warnings disabled") #message(STATUS "CONNECT: GCC: Some warnings disabled")
endif(WITH_WARNINGS) endif(WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU ) add_definitions( -DUNIX -DLINUX -DUBUNTU )
......
...@@ -341,7 +341,9 @@ endif() ...@@ -341,7 +341,9 @@ endif()
set(GRN_WITH_LZ4 "auto" set(GRN_WITH_LZ4 "auto"
CACHE STRING "Support data compression by LZ4.") CACHE STRING "Support data compression by LZ4.")
if(NOT ${GRN_WITH_LZ4} STREQUAL "no") if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
pkg_check_modules(LIBLZ4 liblz4) if(NOT DEFINED LIBLZ4_FOUND)
pkg_check_modules(LIBLZ4 liblz4)
endif()
if(LIBLZ4_FOUND) if(LIBLZ4_FOUND)
set(GRN_WITH_LZ4 TRUE) set(GRN_WITH_LZ4 TRUE)
else() else()
...@@ -392,7 +394,9 @@ endif() ...@@ -392,7 +394,9 @@ endif()
set(GRN_WITH_KYTEA "auto" set(GRN_WITH_KYTEA "auto"
CACHE STRING "use KyTea for morphological analysis") CACHE STRING "use KyTea for morphological analysis")
if(NOT ${GRN_WITH_KYTEA} STREQUAL "no") if(NOT ${GRN_WITH_KYTEA} STREQUAL "no")
pkg_check_modules(KYTEA kytea) if(NOT DEFINED KYTEA_FOUND)
pkg_check_modules(KYTEA kytea)
endif()
if(KYTEA_FOUND) if(KYTEA_FOUND)
set(GRN_WITH_KYTEA TRUE) set(GRN_WITH_KYTEA TRUE)
else() else()
...@@ -440,7 +444,9 @@ endif() ...@@ -440,7 +444,9 @@ endif()
set(GRN_WITH_ZEROMQ "auto" set(GRN_WITH_ZEROMQ "auto"
CACHE STRING "use ZeroMQ for suggestion") CACHE STRING "use ZeroMQ for suggestion")
if(NOT ${GRN_WITH_ZEROMQ} STREQUAL "no") if(NOT ${GRN_WITH_ZEROMQ} STREQUAL "no")
pkg_check_modules(ZEROMQ libzmq) if(NOT DEFINED ZEROMQ_FOUND)
pkg_check_modules(ZEROMQ libzmq)
endif()
if(ZEROMQ_FOUND) if(ZEROMQ_FOUND)
set(GRN_WITH_ZEROMQ TRUE) set(GRN_WITH_ZEROMQ TRUE)
else() else()
...@@ -483,7 +489,9 @@ endif() ...@@ -483,7 +489,9 @@ endif()
set(GRN_WITH_MESSAGE_PACK "auto" set(GRN_WITH_MESSAGE_PACK "auto"
CACHE STRING "use MessagePack for suggestion") CACHE STRING "use MessagePack for suggestion")
if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no") if(NOT ${GRN_WITH_MESSAGE_PACK} STREQUAL "no")
pkg_check_modules(MESSAGE_PACK msgpack) if(NOT DEFINED MESSAGE_PACK_FOUND)
pkg_check_modules(MESSAGE_PACK msgpack)
endif()
if(MESSAGE_PACK_FOUND) if(MESSAGE_PACK_FOUND)
set(GRN_WITH_MESSAGE_PACK TRUE) set(GRN_WITH_MESSAGE_PACK TRUE)
else() else()
......
...@@ -5,6 +5,7 @@ MESSAGE(STATUS "Configuring OQGraph") ...@@ -5,6 +5,7 @@ MESSAGE(STATUS "Configuring OQGraph")
FIND_PACKAGE(Boost 1.40.0) FIND_PACKAGE(Boost 1.40.0)
IF(NOT Boost_FOUND) IF(NOT Boost_FOUND)
MESSAGE(STATUS "Boost not found. OQGraph will not be compiled") MESSAGE(STATUS "Boost not found. OQGraph will not be compiled")
SET(OQGRAPH_OK 0 CACHE INTERNAL "")
RETURN() RETURN()
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
...@@ -12,6 +13,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS}) ...@@ -12,6 +13,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
FIND_PACKAGE(Judy) FIND_PACKAGE(Judy)
IF(NOT Judy_FOUND) IF(NOT Judy_FOUND)
MESSAGE(STATUS "Judy not found. OQGraph will not be compiled") MESSAGE(STATUS "Judy not found. OQGraph will not be compiled")
SET(OQGRAPH_OK 0 CACHE INTERNAL "")
RETURN() RETURN()
ENDIF() ENDIF()
INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR})
...@@ -19,9 +21,9 @@ INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR}) ...@@ -19,9 +21,9 @@ INCLUDE_DIRECTORIES(${Judy_INCLUDE_DIR})
IF(MSVC) IF(MSVC)
# # lp:756966 OQGRAPH on Win64 does not compile # # lp:756966 OQGRAPH on Win64 does not compile
# IF (CMAKE_SIZEOF_VOID_P EQUAL 8) # IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
# SET(BOOST_OK 0) # SET(OQGRAPH_OK 0 CACHE INTERNAL "")
# ELSE() # ELSE()
SET(BOOST_OK 1) SET(OQGRAPH_OK 1 CACHE INTERNAL "")
# ENDIF() # ENDIF()
ELSE() ELSE()
# See if that works. On old gcc it'll fail because of -fno-rtti # See if that works. On old gcc it'll fail because of -fno-rtti
...@@ -33,10 +35,10 @@ CHECK_CXX_SOURCE_COMPILES( ...@@ -33,10 +35,10 @@ CHECK_CXX_SOURCE_COMPILES(
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/property_map/property_map.hpp> #include <boost/property_map/property_map.hpp>
int main() { return 0; } int main() { return 0; }
" BOOST_OK) " OQGRAPH_OK)
ENDIF() ENDIF()
IF(BOOST_OK) IF(OQGRAPH_OK)
ADD_DEFINITIONS(-DHAVE_OQGRAPH) ADD_DEFINITIONS(-DHAVE_OQGRAPH)
IF(MSVC) IF(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" PARENT_SCOPE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" PARENT_SCOPE)
...@@ -50,7 +52,6 @@ IF(BOOST_OK) ...@@ -50,7 +52,6 @@ IF(BOOST_OK)
ENDIF(MSVC) ENDIF(MSVC)
ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1) ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1)
MESSAGE(STATUS "OQGraph OK")
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE STORAGE_ENGINE
...@@ -58,9 +59,11 @@ IF(BOOST_OK) ...@@ -58,9 +59,11 @@ IF(BOOST_OK)
RECOMPILE_FOR_EMBEDDED RECOMPILE_FOR_EMBEDDED
COMPONENT oqgraph-engine COMPONENT oqgraph-engine
LINK_LIBRARIES ${Judy_LIBRARIES}) LINK_LIBRARIES ${Judy_LIBRARIES})
ELSE(BOOST_OK) ELSE(OQGRAPH_OK)
MESSAGE(STATUS "Requisites for OQGraph not met. OQGraph will not be compiled") MESSAGE(STATUS "Requisites for OQGraph not met. OQGraph will not be compiled")
ENDIF(BOOST_OK) ENDIF(OQGRAPH_OK)
ENDFUNCTION() ENDFUNCTION()
CHECK_OQGRAPH() IF(NOT DEFINED OQGRAPH_OK)
CHECK_OQGRAPH()
ENDIF()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment