@@ -83,9 +83,38 @@ def test_update_single_package
83
83
# ...and notably no test for adder, which must be disabled from the option override from above
84
84
assert_equal [ 'simple' , 'using-adder' ] , exes
85
85
}
86
+ update_with_option_off_and_build_with_shorthand_syntax = -> {
87
+ prj . create_lists_from_default_template package : <<~PACK
88
+ CPMAddPackage(gh:cpm-cmake/[email protected]
89
+ OPTIONS "ADDER_BUILD_TESTS OFF"
90
+ )
91
+ PACK
92
+ assert_success prj . configure
93
+ assert_success prj . build
94
+
95
+ exe_dir = File . join ( prj . bin_dir , 'bin' )
96
+ assert File . directory? exe_dir
97
+
98
+ exes = Dir [ exe_dir + '/**/*' ] . filter {
99
+ # on multi-configuration generators (like Visual Studio) the executables will be in bin/<Config>
100
+ # also filter-out other artifacts like .pdb or .dsym
101
+ !File . directory? ( _1 ) && File . stat ( _1 ) . executable?
102
+ } . map {
103
+ # remove .exe extension if any (there will be one on Windows)
104
+ File . basename ( _1 , '.exe' )
105
+ } . sort
106
+
107
+ # we should end up with two executables
108
+ # * simple - the simple example from adder
109
+ # * using-adder - for this project
110
+ # ...and notably no test for adder, which must be disabled from the option override from above
111
+ assert_equal [ 'simple' , 'using-adder' ] , exes
112
+
113
+ }
86
114
87
115
create_with_commit_sha . ( )
88
116
update_to_version_1 . ( )
89
117
update_with_option_off_and_build . ( )
118
+ update_with_option_off_and_build_with_shorthand_syntax . ( )
90
119
end
91
120
end
0 commit comments