Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit ec84080

Browse files
committed
Merge branch 'spo_issue11' into 'master'
Do not throw an error on empty cmake vars Closes #11 See merge request trilinos-devops-consolidation/code/SetProgramOptions!12
2 parents 3ea678b + c4274c9 commit ec84080

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/setprogramoptions/SetProgramOptionsCMake.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ def _fieldhandler_BASH_CMAKE(self, field):
7777
if field.varname in self.owner._var_formatter_cache.keys():
7878
output = self.owner._var_formatter_cache[field.varname].strip('"')
7979
else:
80-
# A CMake var in a BASH command is bad.
81-
msg = "Unhandled variable expansion for `{}`.".format(field.varname)
82-
msg += " CMake variables are only valid in a CMake Fragment file."
83-
raise ValueError(msg)
84-
80+
output = ""
8581
return output
8682

8783
def _fieldhandler_CMAKE_FRAGMENT_ENV(self, field):

src/setprogramoptions/unittests/test_SetProgramOptionsCMake.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,12 @@ def test_SetProgramOptionsCMake_gen_option_list_bash_expandvars_with_unknown_cma
237237
# parse a section
238238
self._execute_parser(parser, section)
239239

240-
with self.assertRaises(ValueError):
241-
parser.gen_option_list(section, generator="bash")
240+
option_list_actual = parser.gen_option_list(section, generator="bash")
241+
option_list_expect = [
242+
'cmake',
243+
'-DCMAKE_CXX_FLAGS:STRING="${LDFLAGS} -foo"',
244+
'-DCMAKE_CXX_FLAGS:STRING="${LDFLAGS} -foo -bar"', '-DCMAKE_F90_FLAGS:STRING=" -baz"'
245+
]
242246

243247
print("-----[ TEST END ]------------------------------------------")
244248

0 commit comments

Comments
 (0)