-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow overriding FetchContent using CPM (#352)
* Override FetchContent paramers, fixes #281 * add check to verify that dependency is cached * update test comment * rename test file and class * update test indentation
- Loading branch information
1 parent
ca421f0
commit a575ab5
Showing
2 changed files
with
92 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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require_relative './lib' | ||
|
||
# Tests FetchContent overriding with CPM | ||
|
||
class FetchContentCompatibility < IntegrationTest | ||
def setup | ||
@cache_dir = File.join(cur_test_dir, 'cpmcache') | ||
ENV['CPM_SOURCE_CACHE'] = @cache_dir | ||
end | ||
|
||
def test_add_dependency_cpm_and_fetchcontent | ||
prj = make_project 'using-adder' | ||
|
||
prj.create_lists_from_default_template package: <<~PACK | ||
CPMAddPackage( | ||
NAME testpack-adder | ||
GITHUB_REPOSITORY cpm-cmake/testpack-adder | ||
VERSION 1.0.0 | ||
OPTIONS "ADDER_BUILD_TESTS OFF" | ||
) | ||
# should have no effect, as we added the dependency using CPM | ||
FetchContent_Declare( | ||
testpack-adder | ||
GIT_REPOSITORY https://github.com/cpm-cmake/testpack-adder | ||
GIT_TAG v1.0.0 | ||
) | ||
FetchContent_MakeAvailable(testpack-adder) | ||
PACK | ||
|
||
# configure with unpopulated cache | ||
assert_success prj.configure | ||
assert_success prj.build | ||
|
||
# cache is populated | ||
assert_true File.exist?(File.join(@cache_dir, "testpack-adder")) | ||
|
||
# configure with populated cache | ||
assert_success prj.configure | ||
assert_success prj.build | ||
end | ||
|
||
end |
Not the same thing! :-)