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
d71d586d
Commit
d71d586d
authored
1 year ago
by
Oskar Lappi
Browse files
Options
Downloads
Patches
Plain Diff
Support for CMake 3.16 as well
parent
ccca35a6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+27
-1
27 additions, 1 deletion
CMakeLists.txt
cmake/install_bimap.cmake
+26
-7
26 additions, 7 deletions
cmake/install_bimap.cmake
include/ojl/bijection.hpp
+3
-0
3 additions, 0 deletions
include/ojl/bijection.hpp
with
56 additions
and
8 deletions
CMakeLists.txt
+
27
−
1
View file @
d71d586d
cmake_minimum_required
(
VERSION 3.16
)
project
(
ojl_bimap VERSION 0.0.1 LANGUAGES CXX
)
#TODO: does this project require C++ 20? Then that should be part of the compile features of the targets
set
(
CMAKE_CXX_STANDARD 20
)
include
(
GNUInstallDirs
)
...
...
@@ -14,11 +13,28 @@ target_include_directories(bimap
$<BUILD_INTERFACE:
${
PROJECT_SOURCE_DIR
}
/include>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
target_compile_features
(
bimap
INTERFACE
cxx_std_20
)
# The above is not enough, because it let's some compilers through that don't support all of C++ 20...
target_compile_options
(
bimap
INTERFACE
-std=c++20
)
#TODO: set the header files here as a list, so there's only one place where they are defined
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.23.0"
)
else
()
target_sources
(
bimap
INTERFACE FILE_SET HEADERS
BASE_DIRS
${
PROJECT_SOURCE_DIR
}
/include/ojl
FILES
${
PROJECT_SOURCE_DIR
}
/include/ojl/bimap.hpp
)
endif
()
add_subdirectory
(
samples
)
option
(
OJL_BIMAP_BUILD_TESTS
"Build tests"
ON
)
...
...
@@ -26,6 +42,16 @@ option(OJL_BIMAP_BUILD_TESTS "Build tests" ON)
option
(
OJL_BIMAP_DOWNLOAD_DEPS
"Download unsatisfied dependencies using FetchContent"
ON
)
if
(
OJL_BIMAP_BUILD_TESTS
)
#TODO: Only checks the initially set compiler? Have to run twice if you change the compiler (maybe this is just how it works, idk)
include
(
CheckCXXCompilerFlag
)
check_cxx_compiler_flag
(
-std=c++20 CXX_20_SUPPORT
)
if
(
NOT CXX_20_SUPPORT
)
message
(
FATAL_ERROR
"The C++ compiler does not support the -std=c++20 flag"
)
endif
()
if
(
OJL_BIMAP_DOWNLOAD_DEPS
)
include
(
cmake/fetch_catch2.cmake
)
endif
()
...
...
This diff is collapsed.
Click to expand it.
cmake/install_bimap.cmake
+
26
−
7
View file @
d71d586d
# Install config
# Define export set bimapTargets, install headers
install
(
TARGETS bimap
EXPORT ojl_bimapExports
FILE_SET HEADERS
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/ojl
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.23.0"
)
# Old way
# Define exports
install
(
TARGETS bimap
EXPORT ojl_bimapExports
)
# Install header directory
# Don't install bijection.hpp yet
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/include/ojl
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
FILES_MATCHING PATTERN
*bimap.hpp
#*bijection.hpp
)
else
()
# Define export set bimapTargets, install headers
install
(
TARGETS bimap
EXPORT ojl_bimapExports
FILE_SET HEADERS
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/ojl
)
endif
()
# Generate the export set file
install
(
EXPORT ojl_bimapExports
...
...
This diff is collapsed.
Click to expand it.
include/ojl/bijection.hpp
+
3
−
0
View file @
d71d586d
//WARNING: WIP, not tested, use at your own risk
#include
<set>
#include
<vector>
#include
<utility>
...
...
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