-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
64 lines (45 loc) · 1.86 KB
/
CMakeLists.txt
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
60
61
62
63
64
cmake_minimum_required(VERSION 3.5)
project(fixparser VERSION 2.0.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
option(BUILD_EXAMPLES "Build examples" ON)
option(BUILD_TESTS "Build test suit" ON)
option(WITH_CONAN "Resolving the dependencies with Conan" ON)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
set(FIXP_SOURCES src/fixparser.hpp)
include("cmake/cmakeconan.cmake")
add_library(fixparser ${FIXP_SOURCES})
set_target_properties(fixparser PROPERTIES LINKER_LANGUAGE CXX)
# Building and resolving dependencies with CONAN?
if(WITH_CONAN)
target_link_libraries(fixparser ${CONAN_LIBS} stdc++fs)
else()
message("Not building with CONAN")
find_package(pugixml REQUIRED)
target_link_libraries(fixparser pugixml stdc++fs)
endif()
target_include_directories(fixparser PRIVATE src)
# Installing targets
export(TARGETS ${CMAKE_PROJECT_NAME}
NAMESPACE ${CMAKE_PROJECT_NAME}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake")
install(TARGETS ${CMAKE_PROJECT_NAME}
EXPORT ${CMAKE_PROJECT_NAME}Config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES ${FIXP_SOURCES} DESTINATION include)
install (FILES "spec/FIX44.xml"
DESTINATION etc/fixparser)
install(EXPORT ${CMAKE_PROJECT_NAME}Config
DESTINATION "${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/cmake"
NAMESPACE ${CMAKE_PROJECT_NAME}::)
if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()