diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 269da2c..b4fd77a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,9 @@ find_package(SourceHighlight REQUIRED) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(TAWASHI_CONFIG_PATH "etc") +set(TAWASHI_CONFIG_FILE "${PROJECT_NAME}.ini") + add_executable(${PROJECT_NAME} main.cpp split_get_vars.cpp @@ -23,6 +26,14 @@ add_executable(${PROJECT_NAME} ini_file.cpp ) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}Config.h" +) + +target_include_directories(${PROJECT_NAME} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include +) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/bette-enums @@ -38,3 +49,7 @@ target_link_libraries(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME} PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1 ) + +target_compile_options(${PROJECT_NAME} + PRIVATE -fdiagnostics-color=always +) diff --git a/src/main.cpp b/src/main.cpp index 7d8aae0..e9c1c1f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ */ #include "incredis/incredis.hpp" +#include "tawashiConfig.h" #include "submit_paste_response.hpp" #include "pastie_response.hpp" #include "index_response.hpp" diff --git a/src/tawashiConfig.h.in b/src/tawashiConfig.h.in new file mode 100644 index 0000000..a98295c --- /dev/null +++ b/src/tawashiConfig.h.in @@ -0,0 +1,22 @@ +/* Copyright 2017, Michele Santullo + * This file is part of "tawashi". + * + * "tawashi" is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * "tawashi" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with "tawashi". If not, see . + */ + +#pragma once + +#define TAWASHI_CONFIG_PATH "@TAWASHI_CONFIG_PATH@" +#define TAWASHI_CONFIG_FILE "@TAWASHI_CONFIG_FILE@" +#define TAWASHI_PATH_PREFIX "@CMAKE_INSTALL_PREFIX@"