2015-11-05 14:32:31 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
2015-12-04 16:30:41 +00:00
|
|
|
set(bare_name "dindexer")
|
2015-12-08 16:16:13 +00:00
|
|
|
project("${bare_name}-if" VERSION 0.1.3 LANGUAGES CXX C)
|
2015-11-11 17:08:17 +00:00
|
|
|
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
2015-12-12 20:27:31 +00:00
|
|
|
|
|
|
|
include(GetGitRevisionDescription)
|
2015-12-27 03:09:08 +00:00
|
|
|
include(Buildlibpqtypes)
|
2015-12-12 20:27:31 +00:00
|
|
|
|
2015-11-13 19:25:32 +00:00
|
|
|
option(DINDEXER_DEBUG_CFG_FILE "Enable to set the config file path to the build path" OFF)
|
2015-12-08 16:07:21 +00:00
|
|
|
option(DINDEXER_WITH_MEDIA_AUTODETECT "Enable code that tries to autodetect the media type and sets --type automatically" ON)
|
2015-12-04 16:32:32 +00:00
|
|
|
set(ACTIONS_PATH "${CMAKE_CURRENT_BINARY_DIR}/src" CACHE STRING "Actions search path")
|
2015-11-11 19:24:10 +00:00
|
|
|
set(PROJECT_VERSION_BETA "1")
|
2015-12-29 17:32:48 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -Wall -Wextra -Wno-missing-field-initializers")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wall -Wextra -O3 -fomit-frame-pointer -Wno-missing-field-initializers")
|
2015-12-10 15:33:38 +00:00
|
|
|
set(DINDEXER_PUB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
2015-12-12 20:27:31 +00:00
|
|
|
get_git_head_revision(GIT_REFSPEC PROJECT_VERSION_GIT)
|
2015-11-05 14:32:31 +00:00
|
|
|
|
2015-12-08 13:56:46 +00:00
|
|
|
if ("${DINDEXER_CONFIG_FILE}" STREQUAL "")
|
2015-11-13 19:25:32 +00:00
|
|
|
if (DINDEXER_DEBUG_CFG_FILE)
|
2015-12-04 16:30:41 +00:00
|
|
|
set(DINDEXER_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${bare_name}.yml CACHE STRING "Path to the config file" FORCE)
|
2015-11-13 19:25:32 +00:00
|
|
|
else()
|
2015-12-04 16:30:41 +00:00
|
|
|
set(DINDEXER_CONFIG_FILE "$HOME/.config/${bare_name}.yml" CACHE STRING "Path to the config file" FORCE)
|
2015-11-13 19:25:32 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2015-12-08 13:56:46 +00:00
|
|
|
message(STATUS "Config file set to \"${DINDEXER_CONFIG_FILE}\"")
|
2015-11-13 19:25:32 +00:00
|
|
|
|
2015-11-11 19:24:10 +00:00
|
|
|
find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options)
|
2015-12-26 22:16:51 +00:00
|
|
|
find_package(PostgreSQL 8.3 REQUIRED)
|
2015-11-11 19:24:10 +00:00
|
|
|
find_package(YamlCpp 0.5.1 REQUIRED)
|
2015-12-27 03:09:08 +00:00
|
|
|
import_libpqtypes_project("${PostgreSQL_INCLUDE_DIRS}")
|
2015-11-11 19:24:10 +00:00
|
|
|
|
2015-12-04 12:58:13 +00:00
|
|
|
add_library(${PROJECT_NAME} INTERFACE)
|
2015-12-04 16:30:41 +00:00
|
|
|
add_library(${bare_name}-inc INTERFACE)
|
2015-12-04 12:58:13 +00:00
|
|
|
|
2015-12-04 16:32:32 +00:00
|
|
|
message(STATUS "Actions search path set to: \"${ACTIONS_PATH}\"")
|
|
|
|
|
2015-11-11 19:24:10 +00:00
|
|
|
configure_file(
|
2015-12-04 16:30:41 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/src/${bare_name}Config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/${bare_name}Config.h"
|
2015-11-11 19:24:10 +00:00
|
|
|
)
|
2015-11-05 16:22:34 +00:00
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
2015-11-11 19:24:10 +00:00
|
|
|
INTERFACE ${Boost_INCLUDE_DIRS}
|
2015-12-04 12:58:13 +00:00
|
|
|
INTERFACE ${PostgreSQL_INCLUDE_DIRS}
|
2015-11-11 02:01:37 +00:00
|
|
|
)
|
|
|
|
|
2015-12-04 16:30:41 +00:00
|
|
|
target_include_directories(${bare_name}-inc
|
2015-12-04 12:58:13 +00:00
|
|
|
INTERFACE ${PROJECT_BINARY_DIR}
|
|
|
|
INTERFACE ${CMAKE_SOURCE_DIR}/include
|
2015-11-11 02:01:37 +00:00
|
|
|
)
|
|
|
|
|
2015-12-04 19:40:02 +00:00
|
|
|
add_subdirectory(src/scan)
|
2015-12-04 12:58:13 +00:00
|
|
|
add_subdirectory(src/pq)
|
2015-12-04 16:32:32 +00:00
|
|
|
add_subdirectory(src/main)
|
2015-12-10 15:33:38 +00:00
|
|
|
add_subdirectory(src/common)
|
2015-12-12 16:53:09 +00:00
|
|
|
add_subdirectory(src/delete)
|
2015-12-13 16:46:42 +00:00
|
|
|
add_subdirectory(src/query)
|
2015-12-14 13:00:10 +00:00
|
|
|
add_subdirectory(src/locate)
|
2015-12-04 12:58:13 +00:00
|
|
|
|
2015-11-11 02:01:37 +00:00
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2015-12-04 12:58:13 +00:00
|
|
|
INTERFACE ${PostgreSQL_LIBRARIES}
|
|
|
|
INTERFACE ${Boost_LIBRARIES}
|
2015-12-04 16:30:41 +00:00
|
|
|
INTERFACE ${bare_name}-pq
|
|
|
|
INTERFACE ${bare_name}-inc
|
2015-11-05 16:22:34 +00:00
|
|
|
)
|
2015-11-12 14:07:26 +00:00
|
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME}
|
2015-12-04 12:58:13 +00:00
|
|
|
INTERFACE WITH_PROGRESS_FEEDBACK
|
2015-11-12 14:07:26 +00:00
|
|
|
)
|