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
7e1f8e0c
Commit
7e1f8e0c
authored
2 months ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
Ignore undefined policies if QUIET is passed to dune_policy(SET)
parent
339499ee
Branches
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmake/modules/DunePolicy.cmake
+11
-7
11 additions, 7 deletions
cmake/modules/DunePolicy.cmake
with
11 additions
and
7 deletions
cmake/modules/DunePolicy.cmake
+
11
−
7
View file @
7e1f8e0c
...
...
@@ -16,7 +16,7 @@ influenced by the global cmake variable ``DUNE_POLICY_DEFAULT``.
.. code-block:: cmake
dune_policy(GET <policy> <var>)
dune_policy(SET <policy> <value>)
dune_policy(SET <policy> <value>
[QUIET]
)
dune_policy(LIST)
.. cmake:command:: dune_define_policy
...
...
@@ -62,7 +62,7 @@ function(dune_policy_help _errorlevel _msg)
message
(
${
_errorlevel
}
"
${
_msg
}
"
"The function `dune_policy` has the following signatures:"
" dune_policy(GET <policy> <var>): extract the value of the given <policy> in the variable <var>."
" dune_policy(SET <policy> <value>): change the given <policy> to <value>."
" dune_policy(SET <policy> <value>
[QUIET]
): change the given <policy> to <value>."
" dune_policy(LIST): list all registered policies with their values."
" dune_policy(HELP): show this help message."
)
endfunction
(
dune_policy_help
)
...
...
@@ -100,11 +100,15 @@ function(dune_get_policy _policy _var)
set
(
${
_var
}
${
_policy_value
}
PARENT_SCOPE
)
endfunction
(
dune_get_policy
)
# set a given _policy to the _value
# set a given _policy to the _value
. If QUIET is passed as additional argument, ignore undefined policies.
function
(
dune_set_policy _policy _value
)
set
(
_quiet FALSE
)
if
(
ARGC GREATER 2 AND
"
${
ARGV2
}
"
STREQUAL
"QUIET"
)
set
(
_quiet TRUE
)
endif
()
get_property
(
_policy_defined GLOBAL PROPERTY DUNE_POLICY_
${
_policy
}
DEFINED
)
if
(
NOT _policy_defined
)
if
(
DUNE_POLICY_IGNORE_UNDEFINED
)
if
(
_quiet OR
DUNE_POLICY_IGNORE_UNDEFINED
)
return
()
else
()
dune_policy_help
(
FATAL_ERROR
"Undefined policy
${
_policy
}
."
)
...
...
@@ -116,16 +120,16 @@ endfunction(dune_set_policy)
# generic policy method to get, set, or list policies
function
(
dune_policy _method
)
if
(
_method STREQUAL
"GET"
)
if
(
ARG
V2
LESS 3
)
if
(
ARG
C
LESS 3
)
dune_policy_help
(
FATAL_ERROR
"Not enough arguments passed to dune_policy(GET...)"
)
endif
()
dune_get_policy
(
${
ARGV1
}
_var
)
set
(
${
ARGV2
}
${
_var
}
PARENT_SCOPE
)
elseif
(
_method STREQUAL
"SET"
)
if
(
ARG
V2
LESS 3
)
if
(
ARG
C
LESS 3
)
dune_policy_help
(
FATAL_ERROR
"Not enough arguments passed to dune_policy(SET...)"
)
endif
()
dune_set_policy
(
${
ARG
V1
}
${
ARGV2
}
)
dune_set_policy
(
${
ARG
N
}
)
elseif
(
_method STREQUAL
"LIST"
)
get_property
(
_policies GLOBAL PROPERTY DUNE_POLICIES
)
foreach
(
_policy
${
policies
}
)
...
...
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