mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 22:58:14 -05:00
* add system property for cpm_add_subdirectory * add test case for system property * lock CMake version in test workflow * refactor to make SYSTEM an extra config option and update tests * remove old comment change * use consistent CMake version and extension for all workflows * make warning more specific and try to trigger on windows * another attempt to trigger warning on MSVC * update readme * simplify test case and use git tag * add SYSTEM option to .cmake-format * forward system arg for source overrides * enable system implicitly for the single argument syntax * Use SYSTEM option for FetchContent and add_subdirectory (#441) * Use SYSTEM option for FetchContent and add_subdirectory * Add SYSTEM option to syntax and doku * Update CPM.cmake * Update .cmake-format --------- Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com> --------- Co-authored-by: Claus Klein <claus.klein@arcormail.de>
49 lines
1.5 KiB
Ruby
49 lines
1.5 KiB
Ruby
require_relative './lib'
|
|
|
|
class SystemWarnings < IntegrationTest
|
|
|
|
def test_dependency_added_using_system
|
|
for use_system in [true, false] do
|
|
prj = make_project name: use_system ? "system" : "no_system", from_template: 'using-adder'
|
|
prj.create_lists_from_default_template package: <<~PACK
|
|
# this commit has a warning in a public header
|
|
CPMAddPackage(
|
|
NAME Adder
|
|
GITHUB_REPOSITORY cpm-cmake/testpack-adder
|
|
GIT_TAG v1.0.1-warnings
|
|
SYSTEM #{use_system ? "YES" : "NO"}
|
|
)
|
|
# all packages using `adder` will error on warnings
|
|
target_compile_options(adder INTERFACE
|
|
$<$<CXX_COMPILER_ID:MSVC>:/Wall /WX>
|
|
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Werror>
|
|
)
|
|
PACK
|
|
|
|
assert_success prj.configure
|
|
if use_system
|
|
assert_success prj.build
|
|
else
|
|
assert_failure prj.build
|
|
end
|
|
end
|
|
end
|
|
|
|
def test_dependency_added_implicitly_using_system
|
|
prj = make_project from_template: 'using-adder'
|
|
prj.create_lists_from_default_template package: <<~PACK
|
|
# this commit has a warning in a public header
|
|
CPMAddPackage("gh:cpm-cmake/testpack-adder@1.0.1-warnings")
|
|
# all packages using `adder` will error on warnings
|
|
target_compile_options(adder INTERFACE
|
|
$<$<CXX_COMPILER_ID:MSVC>:/Wall /WX>
|
|
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Werror>
|
|
)
|
|
PACK
|
|
|
|
assert_success prj.configure
|
|
assert_success prj.build
|
|
end
|
|
|
|
end
|