From fca9b94afd7d9aa521a30293ba3639afe2690fbf Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 4 Dec 2015 16:30:41 +0000 Subject: [PATCH] Make one more empty target that only carries include paths. --- CMakeLists.txt | 17 ++++++++++------- src/pq/CMakeLists.txt | 4 ++-- src/update/CMakeLists.txt | 5 ++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5958e51..4947475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} diff --git a/src/pq/CMakeLists.txt b/src/pq/CMakeLists.txt index 4437a35..542409a 100644 --- a/src/pq/CMakeLists.txt +++ b/src/pq/CMakeLists.txt @@ -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 ) diff --git a/src/update/CMakeLists.txt b/src/update/CMakeLists.txt index d99370c..2ff75d4 100644 --- a/src/update/CMakeLists.txt +++ b/src/update/CMakeLists.txt @@ -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 )