-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
125 lines (100 loc) · 2.84 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
HelloFitty
VERSION 0.21.1
DESCRIPTION "Hello Fitty - a versatile histogram fitting tool for ROOT-based projects."
HOMEPAGE_URL "https://github.com/rlalik/HelloFitty"
LANGUAGES CXX
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Dependencies ----
include(cmake/find_or_fetch_package.cmake)
# find ROOT
find_package(ROOT QUIET REQUIRED COMPONENTS Core Hist)
# FMT
find_or_fetch_package(fmt https://github.com/fmtlib/fmt GIT_TAG 11.1.3 VERSION 11.1.3)
if (fmt_FETCHED)
set(FMT_TARGET $<BUILD_INTERFACE:fmt::fmt-header-only>)
else()
set(FMT_TARGET fmt::fmt)
endif()
# ---- Declare library ----
configure_file(config.h.in inc/hellofitty_config.h)
add_library(
HelloFitty
source/hellofitty.cpp
source/draw_opts.cpp
source/param.cpp
source/entry.cpp
source/fitter.cpp
source/parser_v1.cpp
source/parser_v2.cpp
)
add_library(HelloFitty::HelloFitty ALIAS HelloFitty)
target_link_libraries(HelloFitty
PUBLIC ROOT::Core ROOT::Hist
PRIVATE ${FMT_TARGET}
)
include(GenerateExportHeader)
generate_export_header(
HelloFitty
BASE_NAME HelloFitty
EXPORT_FILE_NAME export/HelloFitty/hellofitty_export.hpp
CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
)
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(HelloFitty PUBLIC HELLOFITTY_STATIC_DEFINE)
endif()
set_target_properties(
HelloFitty PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}"
EXPORT_NAME HelloFitty
OUTPUT_NAME HelloFitty
)
target_include_directories(
HelloFitty ${warning_guard}
PUBLIC
"\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"\$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/inc>"
)
target_include_directories(
HelloFitty SYSTEM
PUBLIC
"\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/export>"
"\$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/inc>"
)
option(BUILD_DICTIONARY "Build ROOT dictionary." OFF)
if (BUILD_DICTIONARY)
# cmake-format: off
root_generate_dictionary(G__HelloFitty_cc hellofitty.hpp
MODULE HelloFitty
LINKDEF inc/LinkDef.h)
# cmake-format: on
endif()
# target_compile_features(HelloFitty PUBLIC cxx_std_11)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Examples ----
if(PROJECT_IS_TOP_LEVEL)
option(BUILD_EXAMPLES "Build examples tree." "${HelloFitty_DEVELOPER_MODE}")
if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()
endif()
# ---- Developer mode ----
if(NOT HelloFitty_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of HelloFitty"
)
endif()
include(cmake/dev-mode.cmake)