1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00

Make one more empty target that only carries include paths.

This commit is contained in:
King_DuckZ 2015-12-04 16:30:41 +00:00
parent 3899680544
commit fca9b94afd
3 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(dindexer VERSION 0.1.2 LANGUAGES CXX C)
set(bare_name "dindexer")
project("${bare_name}-if" VERSION 0.1.2 LANGUAGES CXX C)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
option(DINDEXER_DEBUG_CFG_FILE "Enable to set the config file path to the build path" OFF)
@ -9,9 +10,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11")
if (DINDEXER_CONFIG_FILE STREQUAL "")
if (DINDEXER_DEBUG_CFG_FILE)
set(DINDEXER_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/dindexer.yml CACHE STRING "Path to the config file" FORCE)
set(DINDEXER_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${bare_name}.yml CACHE STRING "Path to the config file" FORCE)
else()
set(DINDEXER_CONFIG_FILE "$HOME/.config/dindexer.yml" CACHE STRING "Path to the config file" FORCE)
set(DINDEXER_CONFIG_FILE "$HOME/.config/${bare_name}.yml" CACHE STRING "Path to the config file" FORCE)
endif()
endif()
message(STATUS "Config file set to ${DINDEXER_CONFIG_FILE}")
@ -21,10 +22,11 @@ find_package(PostgreSQL REQUIRED)
find_package(YamlCpp 0.5.1 REQUIRED)
add_library(${PROJECT_NAME} INTERFACE)
add_library(${bare_name}-inc INTERFACE)
configure_file(
"${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}Config.h.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h"
"${PROJECT_SOURCE_DIR}/src/${bare_name}Config.h.in"
"${PROJECT_BINARY_DIR}/${bare_name}Config.h"
)
target_include_directories(${PROJECT_NAME} SYSTEM
@ -33,7 +35,7 @@ target_include_directories(${PROJECT_NAME} SYSTEM
INTERFACE ${YAMLCPP_INCLUDE_DIR}
)
target_include_directories(${PROJECT_NAME}
target_include_directories(${bare_name}-inc
INTERFACE ${PROJECT_BINARY_DIR}
INTERFACE ${CMAKE_SOURCE_DIR}/include
)
@ -45,7 +47,8 @@ target_link_libraries(${PROJECT_NAME}
INTERFACE ${PostgreSQL_LIBRARIES}
INTERFACE ${YAMLCPP_LIBRARY}
INTERFACE ${Boost_LIBRARIES}
INTERFACE dindexer-pq
INTERFACE ${bare_name}-pq
INTERFACE ${bare_name}-inc
)
target_compile_definitions(${PROJECT_NAME}

View file

@ -1,4 +1,4 @@
project(dindexer-pq CXX)
project(${bare_name}-pq CXX)
add_library(${PROJECT_NAME} STATIC
connection.cpp
@ -7,5 +7,5 @@ add_library(${PROJECT_NAME} STATIC
)
target_link_libraries(${PROJECT_NAME}
PRIVATE dindexer
PRIVATE ${bare_name}-if
)

View file

@ -1,4 +1,4 @@
project(dindexer-update CXX C)
project(${bare_name}-update CXX C)
add_executable(${PROJECT_NAME}
main.cpp
@ -14,9 +14,8 @@ add_executable(${PROJECT_NAME}
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..
PUBLIC ${CMAKE_SOURCE_DIR}/include
)
target_link_libraries(${PROJECT_NAME}
PRIVATE dindexer
PRIVATE ${bare_name}-if
)