-
Notifications
You must be signed in to change notification settings - Fork 31
Feature/test installed package #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5547363
16bb91d
4edb5e6
ad1aa58
809bace
e2af89a
d273e04
d44330d
cb4a036
4a2cc14
4d70f99
272f56f
bdd6729
69a5ffc
e75561e
a3bc8a2
025f2bb
aa8bc04
a4fcc94
11cf1af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| /compile_commands.json | ||
| /build | ||
| /CMakeFiles | ||
| /stagedir | ||
| **/build/ | ||
|
|
||
| # ignore emacs temp files | ||
| *~ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| /compile_commands.json | ||
| /build | ||
| /CMakeFiles | ||
| /stagedir | ||
| **/build/ | ||
|
|
||
| # ignore emacs temp files | ||
| *~ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,16 @@ | |
| "hidden": true, | ||
| "generator": "Ninja", | ||
| "binaryDir": "${sourceDir}/build/${presetName}", | ||
| "installDir": "${sourceDir}/stagedir", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the tests don't assume an |
||
| "cacheVariables": { | ||
| "CMAKE_PREFIX_PATH": { | ||
| "type": "path", | ||
| "value": "${sourceDir}/stagedir" | ||
| }, | ||
| "CMAKE_CXX_STANDARD": "20", | ||
| "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", | ||
| "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "./infra/cmake/use-fetch-content.cmake" | ||
| "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "./infra/cmake/use-fetch-content.cmake", | ||
| "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false | ||
| } | ||
| }, | ||
| { | ||
|
|
@@ -120,6 +126,9 @@ | |
| { | ||
| "name": "_root-build", | ||
| "hidden": true, | ||
| "targets": [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto, mandating targets is no longer required so we shouldn't |
||
| "all_verify_interface_header_sets", "all" | ||
| ], | ||
| "jobs": 0 | ||
| }, | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,31 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| cmake_minimum_required(VERSION 3.25...4.1) | ||
|
|
||
| project( | ||
| beman.{{cookiecutter.project_name}}.examples | ||
| DESCRIPTION "Examaples for Beman implementation of {{cookiecutter.project_name}}" | ||
| LANGUAGES CXX | ||
| VERSION 2.1.1 | ||
| ) | ||
|
|
||
| if(PROJECT_IS_TOP_LEVEL) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example code should not be used for testing. This code serves no purpose for a user who is copy-pasting the example into their own source directory. It serves only to confuse them. The test should be a five line project that calls |
||
| set(_find_package_option REQUIRED) | ||
|
|
||
| # see Professional CMake Chapter 40. Making Projects Consumable | ||
| option(CHECK_PROJECT_IS_CONSUMABLE NO) | ||
| if(CHECK_PROJECT_IS_CONSUMABLE) | ||
| set(_find_package_option) | ||
| endif() | ||
|
|
||
| find_package(beman.{{cookiecutter.project_name}} 2.1.1 EXACT ${_find_package_option}) | ||
| if(NOT TARGET beman::{{cookiecutter.project_name}}) | ||
| add_subdirectory(.. {{cookiecutter.project_name}}_src) | ||
| endif() | ||
|
|
||
| enable_testing() | ||
| endif() | ||
|
|
||
| set(ALL_EXAMPLES identity_direct_usage) | ||
|
|
||
| # Example `identity_as_default_projection` need ranges support: | ||
|
|
@@ -15,7 +41,7 @@ else() | |
| ) | ||
| endif() | ||
|
|
||
| message("Examples to be built: ${ALL_EXAMPLES}") | ||
| message(STATUS "Examples to be built: ${ALL_EXAMPLES}") | ||
|
|
||
| foreach(example ${ALL_EXAMPLES}) | ||
| add_executable(beman.{{cookiecutter.project_name}}.examples.${example}) | ||
|
|
@@ -24,4 +50,8 @@ foreach(example ${ALL_EXAMPLES}) | |
| beman.{{cookiecutter.project_name}}.examples.${example} | ||
| PRIVATE beman::{{cookiecutter.project_name}} | ||
| ) | ||
| add_test( | ||
| NAME beman.{{cookiecutter.project_name}}.examples.${example} | ||
| COMMAND $<TARGET_FILE:beman.{{cookiecutter.project_name}}.examples.${example}> | ||
| ) | ||
| endforeach() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't exist outside the build directory anyway, no need to add them here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #217