-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for shorthand syntax with options
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -403,7 +403,8 @@ CPMAddPackage("gh:jbeder/yaml-cpp#[email protected]") | |
### [nlohmann/json](https://github.com/nlohmann/json) | ||
|
||
```cmake | ||
CPMAddPackage("gh:nlohmann/[email protected]" | ||
CPMAddPackage( | ||
URI "gh:nlohmann/[email protected]" | ||
OPTIONS "JSON_BuildTests OFF" | ||
) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,9 +83,39 @@ def test_update_single_package | |
# ...and notably no test for adder, which must be disabled from the option override from above | ||
assert_equal ['simple', 'using-adder'], exes | ||
} | ||
update_with_option_off_and_build_with_uri_shorthand_syntax = -> { | ||
prj.create_lists_from_default_template package: <<~PACK | ||
CPMAddPackage( | ||
URI gh:cpm-cmake/[email protected] | ||
OPTIONS "ADDER_BUILD_TESTS OFF" | ||
) | ||
PACK | ||
assert_success prj.configure | ||
assert_success prj.build | ||
|
||
exe_dir = File.join(prj.bin_dir, 'bin') | ||
assert File.directory? exe_dir | ||
|
||
exes = Dir[exe_dir + '/**/*'].filter { | ||
# on multi-configuration generators (like Visual Studio) the executables will be in bin/<Config> | ||
# also filter-out other artifacts like .pdb or .dsym | ||
!File.directory?(_1) && File.stat(_1).executable? | ||
}.map { | ||
# remove .exe extension if any (there will be one on Windows) | ||
File.basename(_1, '.exe') | ||
}.sort | ||
|
||
# we should end up with two executables | ||
# * simple - the simple example from adder | ||
# * using-adder - for this project | ||
# ...and notably no test for adder, which must be disabled from the option override from above | ||
assert_equal ['simple', 'using-adder'], exes | ||
|
||
} | ||
|
||
create_with_commit_sha.() | ||
update_to_version_1.() | ||
update_with_option_off_and_build.() | ||
update_with_option_off_and_build_with_uri_shorthand_syntax.() | ||
end | ||
end |