-
Notifications
You must be signed in to change notification settings - Fork 2
2 updates for cmake and project structure #3
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
b208452
4372875
20cb693
29adaac
91e952e
43828f0
33fc97c
2fc9ac6
b56579a
f8e33f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,16 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| cmake_minimum_required(VERSION 3.25) | ||
| cmake_minimum_required(VERSION 3.28...4.2) | ||
|
|
||
| project( | ||
| beman.take_before # CMake Project Name, which is also the name of the top-level | ||
| # targets (e.g., library, executable, etc.). | ||
| DESCRIPTION "A Beman Library for take_before" | ||
| beman.take_before | ||
| DESCRIPTION "take_before_view" | ||
| LANGUAGES CXX | ||
| VERSION 2.2.1 | ||
| VERSION 0.0.1 | ||
| ) | ||
|
|
||
| # gersemi: off | ||
|
|
||
| # [CMAKE.SKIP_TESTS] | ||
| option( | ||
| BEMAN_TAKE_BEFORE_BUILD_TESTS | ||
|
|
@@ -24,12 +25,28 @@ option( | |
| ${PROJECT_IS_TOP_LEVEL} | ||
| ) | ||
|
|
||
| include(CTest) | ||
|
|
||
| add_subdirectory(src/beman/take_before) | ||
| add_library(beman.take_before INTERFACE) | ||
| target_sources( | ||
| beman.take_before | ||
| INTERFACE | ||
| FILE_SET HEADERS | ||
| BASE_DIRS include | ||
| FILES include/beman/take_before/take_before.hpp | ||
| ) | ||
|
|
||
| add_library(beman::take_before ALIAS beman.take_before) | ||
| set_target_properties(beman.take_before PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) | ||
|
|
||
| set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/infra/cmake) | ||
|
Contributor
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. What is this for? |
||
|
|
||
|
|
||
| find_package(beman-install-library REQUIRED) | ||
| beman_install_library(beman.take_before) | ||
|
|
||
| if(BEMAN_TAKE_BEFORE_BUILD_TESTS) | ||
| add_subdirectory(tests/beman/take_before) | ||
| enable_testing() | ||
| add_subdirectory(tests/beman/take_before) | ||
| endif() | ||
|
|
||
| if(BEMAN_TAKE_BEFORE_BUILD_EXAMPLES) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,16 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| set(ALL_EXAMPLES take_before_direct_usage) | ||
|
|
||
| # Example `take_before_as_default_projection` need ranges support: | ||
| include(CheckCXXSymbolExists) | ||
| check_cxx_symbol_exists(__cpp_lib_ranges "ranges" HAS_RANGES) | ||
| # gersemi: off | ||
|
|
||
| if(HAS_RANGES) | ||
| list(APPEND ALL_EXAMPLES take_before_as_default_projection) | ||
| else() | ||
| message( | ||
| WARNING | ||
| "Missing range support! Skip: take_before_as_default_projection" | ||
| ) | ||
| endif() | ||
| set(ALL_EXAMPLES take_before_direct_usage) | ||
|
|
||
| message("Examples to be built: ${ALL_EXAMPLES}") | ||
|
|
||
| foreach(example ${ALL_EXAMPLES}) | ||
| add_executable(beman.take_before.examples.${example}) | ||
| target_sources(beman.take_before.examples.${example} PRIVATE ${example}.cpp) | ||
| add_executable(${example}) | ||
| target_sources(${example} PRIVATE ${example}.cpp) | ||
| target_link_libraries( | ||
| beman.take_before.examples.${example} | ||
| ${example} | ||
|
Member
Author
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. simplifies naming before after: |
||
| PRIVATE beman::take_before | ||
| ) | ||
| endforeach() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,12 @@ | |
| #include <type_traits> | ||
| #include <utility> | ||
|
|
||
| // clang-format off | ||
| #if __cpp_concepts > 202002L | ||
| #error "C++20 concepts is required" | ||
| #endif | ||
| // clang-format on | ||
|
Member
Author
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. also needs to be added to our best practices -- give a nice user error if the CXX version isn't high enough |
||
|
|
||
| namespace beman::take_before { | ||
|
|
||
| // ============================================================================ | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| find_package(GTest REQUIRED) | ||
| find_package(GTest QUIET) | ||
|
|
||
| add_executable(beman.take_before.tests.take_before) | ||
| target_sources(beman.take_before.tests.take_before PRIVATE take_before.test.cpp) | ||
| add_executable(beman_take_before.test) | ||
| target_sources(beman_take_before.test PRIVATE take_before.test.cpp) | ||
| target_link_libraries( | ||
| beman.take_before.tests.take_before | ||
| beman_take_before.test | ||
| PRIVATE beman::take_before GTest::gtest GTest::gtest_main | ||
| ) | ||
|
|
||
| include(GoogleTest) | ||
| gtest_discover_tests(beman.take_before.tests.take_before) | ||
| gtest_discover_tests(beman_take_before.test) |
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.
PR coming for examplar to update this -- 3.28 is minimum for modules and should be our standard now. We've decided range for cmake is best practice