aboutsummaryrefslogtreecommitdiff
path: root/src/common/CMakeLists.txt
blob: d1e3e35a961710f67844bb0b1b7e30d51519d3ce (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
39
40
41
42
43
44
45
46
47
48
49
50
set(CRU_BASE_INCLUDE_DIR ${CRU_INCLUDE_DIR}/cru/common)
add_library(cru_base SHARED
	Base.cpp
	Exception.cpp
	Logger.cpp
	PropertyTree.cpp
	String.cpp
	StringUtil.cpp
	io/Stream.cpp
	io/MemoryStream.cpp
)
target_sources(cru_base PUBLIC
	${CRU_BASE_INCLUDE_DIR}/Base.hpp
	${CRU_BASE_INCLUDE_DIR}/Bitmask.hpp
	${CRU_BASE_INCLUDE_DIR}/Event.hpp
	${CRU_BASE_INCLUDE_DIR}/Exception.hpp
	${CRU_BASE_INCLUDE_DIR}/Logger.hpp
	${CRU_BASE_INCLUDE_DIR}/PreConfig.hpp
	${CRU_BASE_INCLUDE_DIR}/PropertyTree.hpp
	${CRU_BASE_INCLUDE_DIR}/Range.hpp
	${CRU_BASE_INCLUDE_DIR}/SelfResolvable.hpp
	${CRU_BASE_INCLUDE_DIR}/String.hpp
	${CRU_BASE_INCLUDE_DIR}/StringUtil.hpp
	${CRU_BASE_INCLUDE_DIR}/io/Stream.hpp
	${CRU_BASE_INCLUDE_DIR}/io/MemoryStream.hpp
)
target_include_directories(cru_base PUBLIC ${CRU_INCLUDE_DIR})
target_compile_definitions(cru_base PUBLIC $<$<CONFIG:Debug>:CRU_DEBUG>)
target_compile_definitions(cru_base PRIVATE CRU_BASE_EXPORT_API)

if (UNIX)
	target_sources(cru_base PRIVATE
		ErrnoException.cpp
		io/UnixFileStream.cpp
	PUBLIC
		${CRU_BASE_INCLUDE_DIR}/ErrnoException.hpp
		${CRU_BASE_INCLUDE_DIR}/io/UnixFileStream.hpp
	)
endif()

if (WIN32)
	target_compile_definitions(cru_base PUBLIC CRU_PLATFORM_WINDOWS)
elseif(APPLE)
	target_compile_definitions(cru_base PUBLIC CRU_PLATFORM_OSX)
else()
	target_compile_definitions(cru_base PUBLIC CRU_PLATFORM_LINUX)
endif()

find_package(Microsoft.GSL CONFIG REQUIRED)
target_link_libraries(cru_base PUBLIC Microsoft.GSL::GSL)