Skip to content

Commit 01d4bb9

Browse files
committed
feat: Add precompiled header
1 parent 7ec4b0d commit 01d4bb9

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20)
22

33
project(AsyncLogger LANGUAGES CXX VERSION 0.0.1 DESCRIPTION "A lightweight C++20 asyncronous logger.")
44

5-
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src/")
5+
set(SRC_DIR "${PROJECT_SOURCE_DIR}/src")
66

77
# check std::format support
88
if(NOT USE_FMT)
@@ -13,8 +13,8 @@ else()
1313
endif()
1414

1515
file(GLOB_RECURSE SRC_FILES
16-
"${SRC_DIR}**.cpp"
17-
"${SRC_DIR}**.hpp"
16+
"${SRC_DIR}/**.cpp"
17+
"${SRC_DIR}/**.hpp"
1818
)
1919

2020
add_library(${PROJECT_NAME} STATIC ${SRC_FILES})
@@ -40,7 +40,8 @@ endif()
4040
find_package(Threads REQUIRED)
4141
target_link_libraries(${PROJECT_NAME} Threads::Threads )
4242

43-
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER src/Logger.hpp)
43+
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${SRC_DIR}/Logger.hpp")
4444
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
4545

46+
target_precompile_headers(${PROJECT_NAME} PUBLIC "${SRC_DIR}/common.hpp")
4647
target_include_directories(${PROJECT_NAME} PUBLIC ${SRC_DIR})

src/common.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
3+
#include <chrono>
4+
#include <functional>
5+
#include <source_location>
6+
#include <string>
7+
#include <sstream>
8+
#include <thread>

0 commit comments

Comments
 (0)