aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-10-17 18:38:17 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-10-17 18:38:17 +0300
commit6cce85b3a34a4a27d678abf0b4c005a38afd1738 (patch)
treef0c699f6f92b59e7e6613a30c8dd0e3ce3585540
parentupdate cmake-common (diff)
downloadmath-server-6cce85b3a34a4a27d678abf0b4c005a38afd1738.tar.gz
math-server-6cce85b3a34a4a27d678abf0b4c005a38afd1738.zip
cmake: no more target_include_directories hacks
-rw-r--r--server/common/CMakeLists.txt2
-rw-r--r--server/lexer/CMakeLists.txt2
-rw-r--r--server/lexer/details/parse.cpp4
-rw-r--r--server/lexer/error.hpp2
-rw-r--r--server/lexer/lexer.cpp11
-rw-r--r--server/lexer/token.cpp7
-rw-r--r--server/lexer/token_type.cpp5
-rw-r--r--server/main/CMakeLists.txt10
-rw-r--r--server/main/server.cpp5
-rw-r--r--server/main/session.cpp7
-rw-r--r--server/main/session_manager.cpp3
-rw-r--r--server/parser/CMakeLists.txt2
-rw-r--r--server/parser/error.hpp2
-rw-r--r--server/parser/operator.hpp5
-rw-r--r--server/parser/parser.hpp3
-rw-r--r--test/benchmarks/CMakeLists.txt1
-rw-r--r--test/benchmarks/lexer.cpp2
-rw-r--r--test/unit_tests/CMakeLists.txt4
-rw-r--r--test/unit_tests/lexer.cpp10
-rw-r--r--test/unit_tests/parser.cpp4
20 files changed, 47 insertions, 44 deletions
diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt
index 284003f..f3d6605 100644
--- a/server/common/CMakeLists.txt
+++ b/server/common/CMakeLists.txt
@@ -1,5 +1,5 @@
add_library(common INTERFACE)
-target_include_directories(common INTERFACE .)
+target_include_directories(common INTERFACE ..)
find_package(Boost REQUIRED)
target_link_libraries(common INTERFACE Boost::boost)
diff --git a/server/lexer/CMakeLists.txt b/server/lexer/CMakeLists.txt
index 64375e8..fffb5a3 100644
--- a/server/lexer/CMakeLists.txt
+++ b/server/lexer/CMakeLists.txt
@@ -1,6 +1,8 @@
file(GLOB_RECURSE lexer_cpp "*.cpp")
file(GLOB_RECURSE lexer_hpp "*.hpp")
add_library(lexer ${lexer_cpp} ${lexer_hpp})
+target_include_directories(lexer PUBLIC ..)
+
target_link_libraries(lexer PUBLIC common)
find_package(Boost REQUIRED COMPONENTS regex)
diff --git a/server/lexer/details/parse.cpp b/server/lexer/details/parse.cpp
index ccabb7e..3844225 100644
--- a/server/lexer/details/parse.cpp
+++ b/server/lexer/details/parse.cpp
@@ -3,8 +3,8 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include "../error.hpp"
-#include "../token_type.hpp"
+#include <lexer/error.hpp>
+#include <lexer/token_type.hpp>
#include <boost/regex.hpp>
diff --git a/server/lexer/error.hpp b/server/lexer/error.hpp
index 72b3caa..994309a 100644
--- a/server/lexer/error.hpp
+++ b/server/lexer/error.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include "../common/error.hpp"
+#include <common/error.hpp>
#include <string>
diff --git a/server/lexer/lexer.cpp b/server/lexer/lexer.cpp
index 9b4e500..9d3c362 100644
--- a/server/lexer/lexer.cpp
+++ b/server/lexer/lexer.cpp
@@ -3,12 +3,11 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include "lexer.hpp"
-
-#include "details/parse.hpp"
-#include "error.hpp"
-#include "token.hpp"
-#include "token_type.hpp"
+#include <lexer/details/parse.hpp>
+#include <lexer/error.hpp>
+#include <lexer/lexer.hpp>
+#include <lexer/token.hpp>
+#include <lexer/token_type.hpp>
#include <optional>
#include <string>
diff --git a/server/lexer/token.cpp b/server/lexer/token.cpp
index 5516bde..466012f 100644
--- a/server/lexer/token.cpp
+++ b/server/lexer/token.cpp
@@ -3,10 +3,9 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include "token.hpp"
-
-#include "error.hpp"
-#include "token_type.hpp"
+#include <lexer/error.hpp>
+#include <lexer/token.hpp>
+#include <lexer/token_type.hpp>
#include <cmath>
#include <limits>
diff --git a/server/lexer/token_type.cpp b/server/lexer/token_type.cpp
index 037a761..858e565 100644
--- a/server/lexer/token_type.cpp
+++ b/server/lexer/token_type.cpp
@@ -3,9 +3,8 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include "token_type.hpp"
-
-#include "error.hpp"
+#include <lexer/error.hpp>
+#include <lexer/token_type.hpp>
#include <functional>
#include <map>
diff --git a/server/main/CMakeLists.txt b/server/main/CMakeLists.txt
index 39fe0b4..5457c7b 100644
--- a/server/main/CMakeLists.txt
+++ b/server/main/CMakeLists.txt
@@ -3,8 +3,12 @@ option(DEBUG_ASIO "enable debug output for Boost.Asio" OFF)
file(GLOB server_cpp "*.cpp")
file(GLOB server_hpp "*.hpp")
add_executable(server ${server_cpp} ${server_hpp})
-target_link_libraries(server PRIVATE common parser)
set_target_properties(server PROPERTIES OUTPUT_NAME math-server)
+if(DEBUG_ASIO)
+ target_compile_definitions(server PRIVATE BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+endif()
+
+target_link_libraries(server PRIVATE common parser)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -17,10 +21,6 @@ target_link_libraries(server PRIVATE
Boost::filesystem
Boost::program_options)
-if(DEBUG_ASIO)
- target_compile_definitions(server PRIVATE BOOST_ASIO_ENABLE_HANDLER_TRACKING)
-endif()
-
install(TARGETS server RUNTIME DESTINATION bin)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
install(FILES "$<TARGET_PDB_FILE:server>" DESTINATION bin OPTIONAL)
diff --git a/server/main/server.cpp b/server/main/server.cpp
index 72034b1..a7ff294 100644
--- a/server/main/server.cpp
+++ b/server/main/server.cpp
@@ -5,12 +5,13 @@
#include "server.hpp"
-#include "../common/error.hpp"
-#include "../common/log.hpp"
#include "session.hpp"
#include "session_manager.hpp"
#include "settings.hpp"
+#include <common/error.hpp>
+#include <common/log.hpp>
+
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
diff --git a/server/main/session.cpp b/server/main/session.cpp
index 3917514..4725c38 100644
--- a/server/main/session.cpp
+++ b/server/main/session.cpp
@@ -5,11 +5,12 @@
#include "session.hpp"
-#include "../common/error.hpp"
-#include "../common/log.hpp"
-#include "../parser/parser.hpp"
#include "session_manager.hpp"
+#include <common/error.hpp>
+#include <common/log.hpp>
+#include <parser/parser.hpp>
+
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/system/error_code.hpp>
diff --git a/server/main/session_manager.cpp b/server/main/session_manager.cpp
index 753750d..89196b6 100644
--- a/server/main/session_manager.cpp
+++ b/server/main/session_manager.cpp
@@ -5,9 +5,10 @@
#include "session_manager.hpp"
-#include "../common/log.hpp"
#include "session.hpp"
+#include <common/log.hpp>
+
#include <memory>
#include <mutex>
diff --git a/server/parser/CMakeLists.txt b/server/parser/CMakeLists.txt
index 20d39a1..a426c6a 100644
--- a/server/parser/CMakeLists.txt
+++ b/server/parser/CMakeLists.txt
@@ -1,4 +1,4 @@
add_library(parser INTERFACE)
-target_include_directories(parser INTERFACE .)
+target_include_directories(parser INTERFACE ..)
target_link_libraries(parser INTERFACE common lexer)
diff --git a/server/parser/error.hpp b/server/parser/error.hpp
index 6862a8f..6aea015 100644
--- a/server/parser/error.hpp
+++ b/server/parser/error.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include "../common/error.hpp"
+#include <common/error.hpp>
#include <string>
diff --git a/server/parser/operator.hpp b/server/parser/operator.hpp
index 9030c65..b29ae92 100644
--- a/server/parser/operator.hpp
+++ b/server/parser/operator.hpp
@@ -5,10 +5,11 @@
#pragma once
-#include "../lexer/token.hpp"
-#include "../lexer/token_type.hpp"
#include "error.hpp"
+#include <lexer/token.hpp>
+#include <lexer/token_type.hpp>
+
#include <cmath>
namespace math::server::parser {
diff --git a/server/parser/parser.hpp b/server/parser/parser.hpp
index 844b36e..d9ec80d 100644
--- a/server/parser/parser.hpp
+++ b/server/parser/parser.hpp
@@ -5,10 +5,11 @@
#pragma once
-#include "../lexer/lexer.hpp"
#include "error.hpp"
#include "operator.hpp"
+#include <lexer/lexer.hpp>
+
#include <optional>
#include <string_view>
diff --git a/test/benchmarks/CMakeLists.txt b/test/benchmarks/CMakeLists.txt
index 09566cc..340dbcc 100644
--- a/test/benchmarks/CMakeLists.txt
+++ b/test/benchmarks/CMakeLists.txt
@@ -3,7 +3,6 @@ add_executable(benchmarks ${benchmarks_cpp})
set_target_properties(benchmarks PROPERTIES OUTPUT_NAME math-server-benchmarks)
target_link_libraries(benchmarks PRIVATE lexer)
-target_include_directories(benchmarks PRIVATE ../..)
target_link_libraries(benchmarks PRIVATE benchmark benchmark_main)
diff --git a/test/benchmarks/lexer.cpp b/test/benchmarks/lexer.cpp
index 5b0612f..f4ee457 100644
--- a/test/benchmarks/lexer.cpp
+++ b/test/benchmarks/lexer.cpp
@@ -3,7 +3,7 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include <server/lexer/details/parse.hpp>
+#include <lexer/details/parse.hpp>
#include <benchmark/benchmark.h>
diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt
index 5a46f01..d84829d 100644
--- a/test/unit_tests/CMakeLists.txt
+++ b/test/unit_tests/CMakeLists.txt
@@ -1,9 +1,9 @@
file(GLOB unit_tests_cpp "*.cpp")
add_executable(unit_tests ${unit_tests_cpp})
-target_link_libraries(unit_tests PRIVATE lexer parser)
-target_include_directories(unit_tests PRIVATE ../..)
set_target_properties(unit_tests PROPERTIES OUTPUT_NAME math-server-unit-tests)
+target_link_libraries(unit_tests PRIVATE lexer parser)
+
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
target_link_libraries(unit_tests PRIVATE Boost::disable_autolinking Boost::unit_test_framework)
diff --git a/test/unit_tests/lexer.cpp b/test/unit_tests/lexer.cpp
index 9a3fc26..02e806f 100644
--- a/test/unit_tests/lexer.cpp
+++ b/test/unit_tests/lexer.cpp
@@ -3,11 +3,11 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include <server/lexer/details/parse.hpp>
-#include <server/lexer/error.hpp>
-#include <server/lexer/lexer.hpp>
-#include <server/lexer/token.hpp>
-#include <server/lexer/token_type.hpp>
+#include <lexer/details/parse.hpp>
+#include <lexer/error.hpp>
+#include <lexer/lexer.hpp>
+#include <lexer/token.hpp>
+#include <lexer/token_type.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <boost/test/data/test_case.hpp>
diff --git a/test/unit_tests/parser.cpp b/test/unit_tests/parser.cpp
index 655ba39..b86d4d4 100644
--- a/test/unit_tests/parser.cpp
+++ b/test/unit_tests/parser.cpp
@@ -3,8 +3,8 @@
// For details, see https://github.com/egor-tensin/math-server.
// Distributed under the MIT License.
-#include <server/parser/error.hpp>
-#include <server/parser/parser.hpp>
+#include <parser/error.hpp>
+#include <parser/parser.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <boost/test/data/test_case.hpp>