Skip to content

Commit 48f6d48

Browse files
authored
Merge pull request #235 from timblechmann/feature/cmake-improvements
CMake: improvements
2 parents 8ea4a43 + 9070868 commit 48f6d48

File tree

1 file changed

+84
-9
lines changed

1 file changed

+84
-9
lines changed

CMakeLists.txt

Lines changed: 84 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.21)
22
cmake_policy(SET CMP0048 NEW) # enable project VERSION
33
cmake_policy(SET CMP0056 NEW) # honor link flags in try_compile()
44
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -21,11 +21,11 @@ endif()
2121

2222
include(GNUInstallDirs)
2323

24-
option(lager_BUILD_TESTS "Build tests" ON)
25-
option(lager_BUILD_FAILURE_TESTS "Build failure tests" ON)
26-
option(lager_BUILD_EXAMPLES "Build examples" ON)
27-
option(lager_BUILD_DEBUGGER_EXAMPLES "Build examples that showcase the web based debugger" ON)
28-
option(lager_BUILD_DOCS "Build docs" ON)
24+
option(lager_BUILD_TESTS "Build tests" "${PROJECT_IS_TOP_LEVEL}")
25+
option(lager_BUILD_FAILURE_TESTS "Build failure tests" "${PROJECT_IS_TOP_LEVEL}")
26+
option(lager_BUILD_EXAMPLES "Build examples" "${PROJECT_IS_TOP_LEVEL}")
27+
option(lager_BUILD_DEBUGGER_EXAMPLES "Build examples that showcase the web based debugger" "${PROJECT_IS_TOP_LEVEL}")
28+
option(lager_BUILD_DOCS "Build docs" "${PROJECT_IS_TOP_LEVEL}")
2929
option(lager_EMBED_RESOURCES_PATH "Embed installation paths for easier, non-portable resource location" ON)
3030
option(lager_DISABLE_STORE_DEPENDENCY_CHECKS "Disable compile-time checks for store dependencies" OFF)
3131
option(lager_ENABLE_EXCEPTIONS "Always enable exceptions regardless of detected compiler support" OFF)
@@ -52,8 +52,8 @@ endif()
5252
find_program(CCACHE ccache)
5353
if (CCACHE)
5454
message(STATUS "Using ccache: ${CCACHE}")
55-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
56-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
55+
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
56+
set(CMAKE_CXX_LINK_LAUNCHER ${CCACHE})
5757
else()
5858
message(STATUS "Could not find ccache")
5959
endif()
@@ -63,6 +63,7 @@ endif()
6363

6464
# the library
6565
add_library(lager INTERFACE)
66+
add_library(lager::lager ALIAS lager)
6667
target_include_directories(lager INTERFACE
6768
$<BUILD_INTERFACE:${lager_BINARY_DIR}/>
6869
$<BUILD_INTERFACE:${lager_SOURCE_DIR}/>
@@ -83,7 +84,81 @@ if(lager_DISABLE_EXCEPTIONS)
8384
target_compile_definitions(lager INTERFACE LAGER_NO_EXCEPTIONS)
8485
endif()
8586

86-
install(TARGETS lager EXPORT LagerConfig)
87+
target_sources(lager PUBLIC FILE_SET HEADERS
88+
FILES
89+
lager/commit.hpp
90+
lager/config.hpp
91+
lager/constant.hpp
92+
lager/context.hpp
93+
lager/cursor.hpp
94+
lager/debug/debugger.hpp
95+
lager/debug/http_server.hpp
96+
lager/debug/tree_debugger.hpp
97+
lager/deps.hpp
98+
lager/detail/access.hpp
99+
lager/detail/lens_nodes.hpp
100+
lager/detail/merge_nodes.hpp
101+
lager/detail/no_value.hpp
102+
lager/detail/nodes.hpp
103+
lager/detail/signal.hpp
104+
lager/detail/smart_lens.hpp
105+
lager/detail/xform_nodes.hpp
106+
lager/effect.hpp
107+
lager/event_loop/boost_asio.hpp
108+
lager/event_loop/manual.hpp
109+
lager/event_loop/qml.hpp
110+
lager/event_loop/qt.hpp
111+
lager/event_loop/queue.hpp
112+
lager/event_loop/safe_queue.hpp
113+
lager/event_loop/sdl.hpp
114+
lager/extra/cereal/enum.hpp
115+
lager/extra/cereal/immer_array.hpp
116+
lager/extra/cereal/immer_box.hpp
117+
lager/extra/cereal/immer_flex_vector.hpp
118+
lager/extra/cereal/immer_map.hpp
119+
lager/extra/cereal/immer_set.hpp
120+
lager/extra/cereal/immer_table.hpp
121+
lager/extra/cereal/immer_vector.hpp
122+
lager/extra/cereal/inline.hpp
123+
lager/extra/cereal/json.hpp
124+
lager/extra/cereal/optional_nvp.hpp
125+
lager/extra/cereal/struct.hpp
126+
lager/extra/cereal/tuple.hpp
127+
lager/extra/cereal/variant_with_name.hpp
128+
lager/extra/derive.hpp
129+
lager/extra/derive/cereal.hpp
130+
lager/extra/derive/eq.hpp
131+
lager/extra/derive/hana.hpp
132+
lager/extra/derive/hash.hpp
133+
lager/extra/derive/size_check.hpp
134+
lager/extra/enum.hpp
135+
lager/extra/qt.hpp
136+
lager/extra/struct.hpp
137+
lager/extra/thunk.hpp
138+
lager/future.hpp
139+
lager/lens.hpp
140+
lager/lenses.hpp
141+
lager/lenses/at.hpp
142+
lager/lenses/at_or.hpp
143+
lager/lenses/attr.hpp
144+
lager/lenses/optional.hpp
145+
lager/lenses/tuple.hpp
146+
lager/lenses/unbox.hpp
147+
lager/lenses/variant.hpp
148+
lager/reader.hpp
149+
lager/resources_path.hpp.in
150+
lager/sensor.hpp
151+
lager/setter.hpp
152+
lager/state.hpp
153+
lager/store.hpp
154+
lager/tags.hpp
155+
lager/util.hpp
156+
lager/watch.hpp
157+
lager/with.hpp
158+
lager/writer.hpp
159+
)
160+
161+
install(TARGETS lager EXPORT LagerConfig FILE_SET HEADERS)
87162

88163
# requirements for tests and examples
89164
if (lager_BUILD_TESTS OR lager_BUILD_EXAMPLES)

0 commit comments

Comments
 (0)