This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 39
Update dependecies #46
Open
StevenvdSchoot
wants to merge
6
commits into
cpp-best-practices:main
Choose a base branch
from
StevenvdSchoot:features/update_deps
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aeb2a3e
Fix formatting of CMake files
StevenvdSchoot ff1e52c
Fix undefined PROJECT_IS_TOP_LEVEL for cmake <3.21
StevenvdSchoot 4b27224
Support CMake 24 and 25
StevenvdSchoot 9f45cc4
Update project_options to v0.26.3
StevenvdSchoot 4573b52
Update Catch2 to version 3.3.0
StevenvdSchoot 007424d
Update spdlog to version 1.11.0
StevenvdSchoot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
|
||
# A very simple example of a configured file that might need to be | ||
# converted to one that is publicly installed in the case that | ||
# you are developing a library | ||
configure_file("config.hpp.in" "${CMAKE_BINARY_DIR}/configured_files/include/internal_use_only/config.hpp" ESCAPE_QUOTES) | ||
|
||
|
||
configure_file("config.hpp.in" "${CMAKE_BINARY_DIR}/configured_files/include/internal_use_only/config.hpp" | ||
ESCAPE_QUOTES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.15...3.23) | ||
cmake_minimum_required(VERSION 3.16...3.25) | ||
|
||
project(CmakeConfigPackageTests LANGUAGES CXX) | ||
|
||
# ---- Test as standalone project the exported config package ---- | ||
|
||
# This variable is set by project() in CMake 3.21+ | ||
string( | ||
COMPARE EQUAL | ||
"${CMAKE_SOURCE_DIR}" | ||
"${PROJECT_SOURCE_DIR}" | ||
PROJECT_IS_TOP_LEVEL) | ||
|
||
if(PROJECT_IS_TOP_LEVEL OR TEST_INSTALLED_VERSION) | ||
enable_testing() | ||
|
||
|
@@ -21,10 +28,6 @@ find_package(Catch2 CONFIG REQUIRED) | |
|
||
include(Catch) | ||
|
||
add_library(catch_main OBJECT catch_main.cpp) | ||
target_link_libraries(catch_main PUBLIC Catch2::Catch2) | ||
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. Changed only here to |
||
target_link_libraries(catch_main PRIVATE myproject::project_options) | ||
|
||
# Provide a simple smoke test to make sure that the CLI works and can display a --help message | ||
add_test(NAME cli.has_help COMMAND intro --help) | ||
|
||
|
@@ -36,7 +39,7 @@ add_test(NAME cli.version_matches COMMAND intro --version) | |
set_tests_properties(cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION}") | ||
|
||
add_executable(tests tests.cpp) | ||
target_link_libraries(tests PRIVATE myproject::project_warnings myproject::project_options catch_main) | ||
target_link_libraries(tests PRIVATE myproject::project_warnings myproject::project_options Catch2::Catch2WithMain) | ||
|
||
# automatically discover tests that are defined in catch based test files you can modify the unittests. Set TEST_PREFIX | ||
# to whatever you want, or use different for different binaries | ||
|
@@ -45,7 +48,7 @@ catch_discover_tests( | |
TEST_PREFIX | ||
"unittests." | ||
REPORTER | ||
xml | ||
XML | ||
OUTPUT_DIR | ||
. | ||
OUTPUT_PREFIX | ||
|
@@ -55,14 +58,14 @@ catch_discover_tests( | |
|
||
# Add a file containing a set of constexpr tests | ||
add_executable(constexpr_tests constexpr_tests.cpp) | ||
target_link_libraries(constexpr_tests PRIVATE myproject::project_options myproject::project_warnings catch_main) | ||
target_link_libraries(constexpr_tests PRIVATE myproject::project_options myproject::project_warnings Catch2::Catch2WithMain) | ||
|
||
catch_discover_tests( | ||
constexpr_tests | ||
TEST_PREFIX | ||
"constexpr." | ||
REPORTER | ||
xml | ||
XML | ||
OUTPUT_DIR | ||
. | ||
OUTPUT_PREFIX | ||
|
@@ -73,15 +76,15 @@ catch_discover_tests( | |
# Disable the constexpr portion of the test, and build again this allows us to have an executable that we can debug when | ||
# things go wrong with the constexpr testing | ||
add_executable(relaxed_constexpr_tests constexpr_tests.cpp) | ||
target_link_libraries(relaxed_constexpr_tests PRIVATE myproject::project_options myproject::project_warnings catch_main) | ||
target_link_libraries(relaxed_constexpr_tests PRIVATE myproject::project_options myproject::project_warnings Catch2::Catch2WithMain) | ||
target_compile_definitions(relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE) | ||
|
||
catch_discover_tests( | ||
relaxed_constexpr_tests | ||
TEST_PREFIX | ||
"relaxed_constexpr." | ||
REPORTER | ||
xml | ||
XML | ||
OUTPUT_DIR | ||
. | ||
OUTPUT_PREFIX | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I've kept this lines to avoid changing to
Catch2::Catch2WithMain
in all other target_link_libraries. It worked anyway.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.
Could you elaborate on what the benefits are of keeping the catch_main target? When keeping it it just serves as an alias for Catch2::CatchWithMain. My initial thought was to remove it, since it shortens and simplifies the cmake file and thus servers the purpose of a minimal starter project better.
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.
I think none to be honest. But you see that's an project_options include. I'm not sure if it changes something or not.