File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed
Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ compile-headers: $(_build_path)/CMakeCache.txt ## Compile the headers
7878install : $(_build_path ) /CMakeCache.txt compile # # Install the project
7979 cmake --install $(_build_path ) --config $(CONFIG ) --component beman.optional --verbose
8080
81+ .PHONY : clean-install
82+ clean-install :
83+ -rm -rf .install
84+
85+ realclean : clean-install
86+
8187ctest : $(_build_path ) /CMakeCache.txt # # Run CTest on current build
8288 cd $(_build_path ) && ctest --output-on-failure -C $(CONFIG )
8389
@@ -195,6 +201,18 @@ mrdocs: ## Build the docs with Doxygen
195201 cd docs && NO_COLOR=1 mrdocs mrdocs.yml 2>&1 | sed ' s/\x1b\[[0-9;]*m//g'
196202 find docs/adoc -name ' *.adoc' | xargs asciidoctor
197203
204+ .PHONY : testinstall
205+ testinstall : install
206+ testinstall : # # Test the installed package
207+ cmake -S installtest -B installtest/.build
208+ cmake --build installtest/.build --target test
209+
210+ .PHONY : clean-testinstall
211+ clean-testinstall :
212+ -rm -rf installtest/.build
213+
214+ realclean : clean-testinstall
215+
198216# Help target
199217.PHONY : help
200218help : # # Show this help.
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.30)
2+ project (ConsumerBemanOptional)
3+
4+ set (CMAKE_CXX_STANDARD 20)
5+
6+ # Enable testing in this separate project
7+ enable_testing ()
8+
9+ # Find the installed package
10+ set (OPTIONAL_INSTALL_DIR "../.install/lib/cmake/beman.optional" )
11+ find_package (
12+ beman.optional
13+ REQUIRED
14+ PATHS ${OPTIONAL_INSTALL_DIR}
15+ NO_DEFAULT_PATH
16+ )
17+
18+ # Add your test executable
19+ add_executable (TestInstalledOptional test .cpp)
20+
21+ # Link against the imported target
22+ target_link_libraries (TestInstalledOptional beman::optional )
23+
24+ # Register the test with CTest
25+ add_test (NAME RunInstalledTest COMMAND TestInstalledOptional)
26+
27+ # Ensure 'make test' first builds the 'all' target
28+ set (CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE )
Original file line number Diff line number Diff line change 1+ // testinstall/test.cpp -*-C++-*-
2+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+ #include < beman/optional/optional.hpp>
5+ #include < iostream>
6+
7+ int main () {
8+ beman::optional::optional<int > empty_opt{};
9+ if (!empty_opt) {
10+ std::cout << " empty_opt is empty!\n " ;
11+ }
12+
13+ beman::optional::optional<int > opt{26 };
14+ if (opt) {
15+ std::cout << " opt = " << *opt << " \n " ;
16+ }
17+
18+ return 0 ;
19+ }
You can’t perform that action at this time.
0 commit comments