-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (46 loc) · 1.66 KB
/
CMakeLists.txt
File metadata and controls
59 lines (46 loc) · 1.66 KB
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
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.30)
# CMAKE_OSX_SYSROOT is a macOS-specific setting that specifies the SDK path.
# This is ignored on non-Apple platforms, so it's safe to include in cross-platform builds.
execute_process(
COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
project(BacktestingEngine)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Configure libpqxx build
set(PQXX_LIBRARIES_INSTALL ON)
set(SKIP_BUILD_TEST ON)
set(SKIP_CONFIGURE_LIBPQXX OFF)
# Disable warningsfor external libraries
set(PREV_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w")
endif()
# Quiet CMAKE output
set(CMAKE_INSTALL_MESSAGE NEVER)
set(CMAKE_MESSAGE_LOG_LEVEL "WARNING")
# Build libpqxx from source
add_subdirectory(external/libpqxx EXCLUDE_FROM_ALL)
# Include directories
include_directories(
${CMAKE_SOURCE_DIR}/source/include
${CMAKE_SOURCE_DIR}/source/include/utilities
${CMAKE_SOURCE_DIR}/source/include/models
${CMAKE_SOURCE_DIR}/source/include/trading
${CMAKE_SOURCE_DIR}/source/include/trading_definitions
${CMAKE_SOURCE_DIR}/external
)
# Collect all .cpp files in the src directory
file(GLOB_RECURSE SOURCES "source/*.cpp")
# Create a library of your project's code
add_library(BacktestingEngineLib STATIC ${SOURCES})
# Link against pqxx
target_link_libraries(BacktestingEngineLib pqxx)
# Main executable
add_executable(BacktestingEngine source/main.cpp)
target_link_libraries(BacktestingEngine BacktestingEngineLib)