Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ojl_bimap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Oskar Lappi
ojl_bimap
Commits
66cbb3e9
Commit
66cbb3e9
authored
1 year ago
by
Oskar Lappi
Browse files
Options
Downloads
Patches
Plain Diff
FetchContent only used as a backup now
parent
a896f630
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+12
-3
12 additions, 3 deletions
CMakeLists.txt
cmake/fetch_catch2.cmake
+14
-11
14 additions, 11 deletions
cmake/fetch_catch2.cmake
test/cmake/TestSetup.cmake
+15
-19
15 additions, 19 deletions
test/cmake/TestSetup.cmake
with
41 additions
and
33 deletions
CMakeLists.txt
+
12
−
3
View file @
66cbb3e9
...
...
@@ -6,7 +6,16 @@ set(CMAKE_CXX_STANDARD 20)
add_library
(
bimap INTERFACE
)
target_include_directories
(
bimap INTERFACE include
)
include
(
cmake/fetch_catch2.cmake
)
enable_testing
()
add_subdirectory
(
samples
)
add_subdirectory
(
test
)
option
(
DOWNLOAD_DEPS
"Download unsatisfied dependencies using FetchContent"
ON
)
option
(
BUILD_TESTS
"Build tests"
ON
)
if
(
BUILD_TESTS
)
if
(
DOWNLOAD_DEPS
)
include
(
cmake/fetch_catch2.cmake
)
endif
()
enable_testing
()
add_subdirectory
(
test
)
endif
()
This diff is collapsed.
Click to expand it.
cmake/fetch_catch2.cmake
+
14
−
11
View file @
66cbb3e9
include
(
FetchContent
)
set
(
FETCHCONTENT_QUIET FALSE
)
FetchContent_Declare
(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG devel
GIT_PROGRESS TRUE
OVERRIDE_FIND_PACKAGE
)
find_package
(
Catch2
)
if
(
NOT Catch2_FOUND
)
message
(
"Could not find Catch2 locally, downloading"
)
set
(
FETCHCONTENT_QUIET FALSE
)
FetchContent_Declare
(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG devel
GIT_PROGRESS TRUE
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable
(
c
atch2
)
#set
(Catch2
_DIR
FetchContent_MakeAvailable
(
C
atch2
)
endif
()
find_package
(
Catch2
)
This diff is collapsed.
Click to expand it.
test/cmake/TestSetup.cmake
+
15
−
19
View file @
66cbb3e9
...
...
@@ -3,27 +3,23 @@ macro(find_catch2_and_define_test_target)
set
(
TestInterface_EXISTS 1
)
endif
()
if
(
NOT Catch2_FOUND
)
message
(
"Loading Catch2 and defining test targets for
${
CMAKE_CURRENT_LIST_DIR
}
"
)
find_package
(
Catch2 REQUIRED
)
if
(
NOT TestInterface_EXISTS
)
add_library
(
TestInterface INTERFACE
)
find_package
(
Catch2 REQUIRED
)
if
(
Catch2_FOUND
)
message
(
" found Catch2, version:
${
Catch2_VERSION
}
"
)
if
(
NOT TARGET Catch2::Catch2WithMain
)
message
(
SEND_ERROR
"Tests depend on Catch2::Catch2WithMain, but Catch2 was built without "
"it. To fix this, build Catch2 with CATCH_BUILD_STATIC_LIBRARY=ON
\n
"
"(see: https://github.com/catchorg/Catch2/releases/tag/v2.13.5)"
)
endif
()
if
(
Catch2_FOUND
)
message
(
" found Catch2, version:
${
Catch2_VERSION
}
"
)
if
(
NOT TARGET Catch2::Catch2WithMain
)
message
(
SEND_ERROR
"Tests depend on Catch2::Catch2WithMain, but Catch2 was built without "
"it. To fix this, build Catch2 with CATCH_BUILD_STATIC_LIBRARY=ON
\n
"
"(see: https://github.com/catchorg/Catch2/releases/tag/v2.13.5)"
)
endif
()
endif
()
if
(
NOT TestInterface_EXISTS
)
target_link_libraries
(
TestInterface INTERFACE
${
PROJECT_NAME
}
Catch2::Catch2WithMain
)
if
(
NOT
${
Catch2_VERSION
}
VERSION_GREATER_EQUAL
"3"
)
target_compile_definitions
(
TestInterface INTERFACE TESTS_CATCH2_USE_OLD_HEADER=1
)
endif
()
endif
()
if
(
NOT TestInterface_EXISTS
)
add_library
(
TestInterface INTERFACE
)
target_link_libraries
(
TestInterface INTERFACE
${
PROJECT_NAME
}
Catch2::Catch2WithMain
)
if
(
NOT
${
Catch2_VERSION
}
VERSION_GREATER_EQUAL
"3"
)
target_compile_definitions
(
TestInterface INTERFACE TESTS_CATCH2_USE_OLD_HEADER=1
)
endif
()
endif
()
endmacro
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment