summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: d064c3c48077f0d6a01c4e5035a01f696ce7c395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.0)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(cxxformat)
add_library(cxxformat INTERFACE
	include/cxxformat/cxxformat
	include/cxxformat/core.hpp
	include/cxxformat/file_ptr.hpp
	include/cxxformat/formatters.hpp
	include/cxxformat/helpers.hpp
	include/cxxformat/ostream.hpp
	include/cxxformat/runtime.hpp
	include/cxxformat/string.hpp
)
target_include_directories(cxxformat INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(cxxformat INTERFACE cxx_std_20)

add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cxxformat.hpp"
	COMMAND "${CMAKE_COMMAND}" "-DOUTPUT=${CMAKE_CURRENT_BINARY_DIR}/cxxformat.hpp" "-DSRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}" -P "${CMAKE_CURRENT_SOURCE_DIR}/GenerateSingleHeader.cmake"
	DEPENDS include/cxxformat/core.hpp
		include/cxxformat/file_ptr.hpp
		include/cxxformat/formatters.hpp
		include/cxxformat/helpers.hpp
		include/cxxformat/ostream.hpp
		include/cxxformat/runtime.hpp
		include/cxxformat/string.hpp
		GenerateSingleHeader.cmake
)

add_custom_target(single-header DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cxxformat.hpp")

add_executable(test EXCLUDE_FROM_ALL main.cpp)
target_link_libraries(test PRIVATE cxxformat)

add_executable(benchmark EXCLUDE_FROM_ALL benchmark.cpp)
target_link_libraries(benchmark PRIVATE cxxformat)