Skip to content

Commit

Permalink
build: add set_if_not optional args VERBOSE and FORCE
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Nov 16, 2024
1 parent afef4eb commit 88dc0ba
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/cmake/set_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@

# Set a variable to a value if it is not already defined.
macro (set_if_not var value)
cmake_parse_arguments(_sin # prefix
# noValueKeywords:
"VERBOSE;FORCE"
# singleValueKeywords:
""
# multiValueKeywords:
""
# argsToParse:
${ARGN})
if (NOT DEFINED ${var})
set (${var} ${value})
unset (_sin_extra_args)
if (_sin_FORCE)
list (APPEND _sin_extra_args FORCE)
endif ()
set (${var} ${value} ${_sin_extra_args})
if (_sin_VERBOSE)
message (VERBOSE "set ${var} = ${value}")
endif ()
endif ()
endmacro ()

Expand Down

0 comments on commit 88dc0ba

Please sign in to comment.