Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Core Modules
dune-common
Commits
53fb6ae7
Commit
53fb6ae7
authored
3 years ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
Remove deprecated dune_list_filter and deprecate file DuneCMakeCompat.cmake
Include deprecation period
parent
0e78dc72
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1022
Remove deprecated dune_list_filter and deprecate file DuneCMakeCompat.cmake
Pipeline
#40325
passed
3 years ago
Stage: test
Stage: downstream
Pipeline: Dune Nightly Test
#40329
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
cmake/modules/DuneCMakeCompat.cmake
+1
-95
1 addition, 95 deletions
cmake/modules/DuneCMakeCompat.cmake
with
5 additions
and
95 deletions
CHANGELOG.md
+
4
−
0
View file @
53fb6ae7
...
...
@@ -6,6 +6,10 @@
-
Remove the variable
`DUNE_DEFAULT_LIBS`
-
Deprecate cmake file
`DuneCMakeCompat.cmake`
that just contained the removed function
`dune_list_filter`
# Release 2.8
-
Set minimal required CMake version in cmake to >= 3.13.
...
...
This diff is collapsed.
Click to expand it.
cmake/modules/DuneCMakeCompat.cmake
+
1
−
95
View file @
53fb6ae7
# Module with backward compatibility implementation of newer cmake functionality
#
# .. cmake_module::
#
# This module contains backward compatibility implementations of cmake
# functionality that is not available in all cmake versions we support.
#
# * :ref:`dune_list_filter(...) <dune_list_filter>` for ``list(FILTER
# ...)`` from cmake 3.7
#
#
# .. cmake_function:: dune_list_filter
#
# .. cmake_brief::
#
# Compatibility implementation of ``list(FILTER)``
#
# .. cmake_param:: list
# :positional:
# :single:
# :required:
#
# Name of list variable used as both input and output.
#
# .. cmake_param:: <INCLUDE|EXCLUDE>
# :positional:
# :option:
# :required:
#
# Whether to include or to exclude the items matching the regular
# expression.
#
# .. cmake_param:: REGEX
# :single:
# :required:
# :argname: regular_expression
#
# The regular expression to match the items against.
#
# Match each item in the list against the regular expression. In
# ``INCLUDE`` mode the result contains all items that matched, in
# ``EXCLUDE`` mode it contains all items that did not match. Store the
# result back in the variable ``list`` in the scope of the caller.
#
# This is exactly the same as the ``list(FILTER ...)`` command available in
# cmake 3.7 and onward.
include_guard
(
GLOBAL
)
# list(FILTER...) was introduced in cmake 3.6, this is a compatibility
# implementation for earlier cmakes
function
(
dune_list_filter list mode REGEX regular_expression
)
message
(
DEPRECATION
"dune_list_filter is deprecated and will be removed after Dune 2.8. Use list(FILTER ...) from CMake 3.6"
)
# validate arguments
if
(
NOT
((
"
${
mode
}
"
STREQUAL
"INCLUDE"
)
OR
(
"
${
mode
}
"
STREQUAL
"EXCLUDE"
)))
message
(
FATAL_ERROR
"unsupported mode '
${
mode
}
', must be either INCLUDE or EXCLUDE"
)
endif
()
if
(
NOT
(
"
${
REGEX
}
"
STREQUAL
"REGEX"
))
message
(
FATAL_ERROR
"dune_list_filter can only filter by regular expression"
)
endif
()
if
(
"
${
ARGC
}
"
GREATER 4
)
message
(
FATAL_ERROR
"extra arguments given: <
${
ARGN
}
>"
)
endif
()
# cmake can't destinguish between empty lists and lists with one empty
# element. This is a problem when consecutively appending elements to a
# list: if the first elements we append are empty, we loose them. The
# "non-empty" token makes sure we start with a non-empty list and avoid this
# problem.
set
(
matched
"non-empty"
)
set
(
unmatched
"non-empty"
)
foreach
(
item IN LISTS
"
${
list
}
"
)
# list(APPEND) does not quote the appended item (as of cmake 3.7.2), so do
# it manually
string
(
REPLACE
[[;]]
[[\;]]
quoted_item
"
${
item
}
"
)
if
(
"
${
item
}
"
MATCHES
"
${
regular_expression
}
"
)
list
(
APPEND matched
"
${
quoted_item
}
"
)
else
()
list
(
APPEND unmatched
"
${
quoted_item
}
"
)
endif
()
endforeach
(
item
)
if
(
"
${
mode
}
"
STREQUAL
"INCLUDE"
)
set
(
result
"
${
matched
}
"
)
else
()
set
(
result
"
${
unmatched
}
"
)
endif
()
# remove the non-empty token from above. If the proper result would be a
# list of one empty element, we have no way of preserving that, it will turn
# into an empty list.
string
(
REGEX REPLACE
"^non-empty;?"
""
result
"
${
result
}
"
)
# export
set
(
"
${
list
}
"
"
${
result
}
"
PARENT_SCOPE
)
endfunction
(
dune_list_filter
)
message
(
DEPRECATION
"DuneCMakeCompat.cmake file is deprecated. Will be removed after release 2.9"
)
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