Store paths to glog include and library in CMakeLists

Reviewers: buda, mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D615
This commit is contained in:
Teon Banek 2017-08-01 12:42:50 +02:00
parent 2ec1080ac9
commit 777b6a8101
2 changed files with 11 additions and 6 deletions

View File

@ -219,7 +219,7 @@ include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs)
# needed to include configured files (plan_compiler_flags.hpp)
set(generated_headers_dir ${CMAKE_BINARY_DIR}/generated_headers)
include_directories(${generated_headers_dir})
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/libs/glog/include)
include_directories(SYSTEM ${GLOG_INCLUDE_DIR})
# -----------------------------------------------------------------------------
# openCypher parser -----------------------------------------------------------
@ -301,7 +301,7 @@ set(memgraph_src_files
# memgraph_lib and memgraph_pic depend on these libraries
set(MEMGRAPH_ALL_LIBS stdc++fs Threads::Threads fmt
antlr_opencypher_parser_lib dl ${CMAKE_SOURCE_DIR}/libs/glog/lib/libglog.a gflags)
antlr_opencypher_parser_lib dl ${GLOG_LIBRARY} gflags)
if (READLINE_FOUND)
list(APPEND MEMGRAPH_ALL_LIBS ${READLINE_LIBRARY})
endif()
@ -329,7 +329,7 @@ add_subdirectory(tests)
# -----------------------------------------------------------------------------
add_custom_target(recursive_include_plan_template
COMMAND ./recursive_include --roots ${src_dir} ${libs_dir} ${CMAKE_BINARY_DIR}/libs/gflags/include ${libs_dir}/glog/include --start ${src_dir}/query/plan_template_cpp --copy ${CMAKE_BINARY_DIR}/include
COMMAND ./recursive_include --roots ${src_dir} ${libs_dir} ${CMAKE_BINARY_DIR}/libs/gflags/include ${GLOG_INCLUDE_DIR} --start ${src_dir}/query/plan_template_cpp --copy ${CMAKE_BINARY_DIR}/include
DEPENDS ${src_dir}/query/plan_template_cpp
SOURCES ${src_dir}/query/plan_template_cpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake

View File

@ -33,11 +33,16 @@ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_SAVED})
# doesn't detect gflags if we do `add_subdirectory`.
include(ExternalProject)
ExternalProject_Add(glog DEPENDS gflags
PREFIX ${CMAKE_SOURCE_DIR}/libs/glog
SOURCE_DIR ${CMAKE_SOURCE_DIR}/libs/glog
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/glog
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/glog
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/libs/glog
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/glog
-Dgflags_DIR=${CMAKE_CURRENT_BINARY_DIR}/gflags)
set(GLOG_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/glog/lib/libglog.a CACHE FILEPATH
"Path to glog library" FORCE)
set(GLOG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/glog/include CACHE PATH
"Path to glog include directory" FORCE)
mark_as_advanced(GLOG_LIBRARY GLOG_INCLUDE_DIR)
# setup cppitertools
# CLion compatiblity; the target won't be built