diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index d865872d23..1a8bf0a8be 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -129,6 +129,11 @@ fn get_all_commands() []Command { line: '$vexe install nedpals.args' okmsg: '`v install` works.' } + res << Command{ + line: '$vexe -usecache -cg examples/hello_world.v' + okmsg: '`v -usecache -cg` works.' + rmfile: 'examples/hello_world' + } // NB: test that a program that depends on thirdparty libraries with its // own #flags (tetris depends on gg, which uses sokol) can be compiled // with -usecache: diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index 2862c574bd..6d179296ec 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -116,9 +116,9 @@ pub fn (mut p Preferences) fill_with_defaults() { '$p.backend | $p.os | $p.ccompiler | $p.is_prod | $p.sanitize', p.cflags.trim_space(), p.third_party_option.trim_space(), - '$p.compile_defines_all', - '$p.compile_defines', - '$p.lookup_path', + p.compile_defines_all.str(), + p.compile_defines.str(), + p.lookup_path.str(), ]) // eprintln('prefs.cache_manager: $p') // disable use_cache for specific cases: diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 37c79ff74f..a8f6574ab3 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -806,7 +806,9 @@ pub fn get_host_arch() Arch { fn parse_define(mut prefs Preferences, define string) { define_parts := define.split('=') - prefs.build_options << '-d $define' + if !(prefs.is_debug && define == 'debug') { + prefs.build_options << '-d $define' + } if define_parts.len == 1 { prefs.compile_defines << define prefs.compile_defines_all << define