File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed
tests/beman/inplace_vector Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,13 @@ option(
3333 ${PROJECT_IS_TOP_LEVEL}
3434)
3535
36+ # includes
3637include (GNUInstallDirs)
3738include (CMakePackageConfigHelpers)
3839
3940add_library(beman_inplace_vector INTERFACE)
4041# [CMAKE.LIBRARY_ALIAS]
41- add_library(beman ::inplace_vector ALIAS beman_inplace_vector)
42-
43- # XXX target_include_directories(beman.inplace_vector ... ?
42+ add_library(beman ::beman_inplace_vector ALIAS beman_inplace_vector)
4443
4544target_sources(
4645 beman_inplace_vector
@@ -62,13 +61,14 @@ target_compile_features(
6261 "$<$< NOT :$< COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
6362)
6463
64+ # export cmake config package
6565block()
6666 # copied from execution26:
6767 set(TARGET_NAME beman_inplace_vector)
6868 set(TARGET_NAMESPACE beman)
6969 # set(TARGET_PREFIX ${TARGET_NAMESPACE}.${TARGET_NAME}) # FIXME: not used yet? CK
7070 # set(TARGET_LIBRARY ${PROJECT_NAME})
71- # set(TARGET_ALIAS ${TARGET_LIBRARY }::${TARGET_LIBRARY})
71+ # set(TARGET_ALIAS ${TARGET_NAMESPACE }::${TARGET_LIBRARY})
7272 set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
7373 set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
7474 set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
Original file line number Diff line number Diff line change 44@PACKAGE_INIT@
55
66include ("${CMAKE_CURRENT_LIST_DIR}/@
[email protected] ")
7- check_required_components("@TARGET_LIBRARY @")
7+ check_required_components("@PROJECT_NAME @")
Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22
3+ cmake_minimum_required (VERSION 3.27...3.31)
4+
5+ project (beman_inplace_vector_example LANGUAGES CXX)
6+
7+ if (PROJECT_IS_TOP_LEVEL)
8+ find_package (beman_inplace_vector 1.0.0 EXACT REQUIRED)
9+ enable_testing ()
10+ endif ()
11+
312set (ALL_EXAMPLES fibonacci)
413
514message (STATUS "Examples to be built: ${ALL_EXAMPLES} " )
@@ -12,6 +21,12 @@ foreach(example ${ALL_EXAMPLES})
1221 )
1322 target_link_libraries (
1423 beman.inplace_vector.examples.${example}
15- beman::inplace_vector
24+ beman::beman_inplace_vector
1625 )
26+ if (PROJECT_IS_TOP_LEVEL)
27+ add_test (
28+ NAME ${example}
29+ COMMAND beman.inplace_vector.examples.${example}
30+ )
31+ endif ()
1732endforeach ()
Original file line number Diff line number Diff line change @@ -12,3 +12,18 @@ target_link_libraries(
1212)
1313
1414add_test(NAME beman.inplace_vector.test COMMAND beman.inplace_vector.test)
15+
16+ # test if the targets are findable from the build directory
17+ # NOTE: for an INTERFACE library, we may always use the -C Debug! CK
18+ add_test(
19+ NAME find-package-test
20+ COMMAND
21+ ${CMAKE_CTEST_COMMAND} --verbose --output-on-failure -C $<CONFIG>
22+ --build-and-test "${PROJECT_SOURCE_DIR}/examples"
23+ "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator
24+ ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM}
25+ --build-options "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
26+ "-DCMAKE_CXX_STANDARD =${CMAKE_CXX_STANDARD}"
27+ "-DCMAKE_BUILD_TYPE =$< CONFIG>"
28+ "-DCMAKE_PREFIX_PATH =${CMAKE_PREFIX_PATH}"
29+ )
You can’t perform that action at this time.
0 commit comments