mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Add several test cases to verify that install(PACKAGE_INFO) is working as expected. These cover validating the output for several scenarios, improper use of the command, effects of command arguments, and a handful of improper uses. Tests that should still be added include one covering DESTINATION (both the default and user-specified) and the CPS location and link_location attributes. These have been skipped for now because the former requires actually installing a test project, and the latter involves validating attributes whose values are platform-dependent. (In particular, I don't think link_location will appear on not-Windows.) Additionally, there is no coverage of (other) common install-command arguments such as PERMISSIONS, COMPONENT, etc.; however, because the logic implementing these is shared, the tests covering them for other sub-commands is probably sufficient. Note that, because the files are generated in a location that includes a hash of the install destination, and because the default destination is platform dependent, the tests need to specify a fixed DESTINATION so that the location of generated files (which we need to inspect and validate) is predictable.
17 lines
652 B
CMake
17 lines
652 B
CMake
include(${CMAKE_CURRENT_LIST_DIR}/Assertions.cmake)
|
|
|
|
set(out_dir "${RunCMake_BINARY_DIR}/Metadata-build/CMakeFiles/Export/510c5684a4a8a792eadfb55bc9744983")
|
|
|
|
file(READ "${out_dir}/foo.cps" content)
|
|
expect_value("${content}" "foo" "name")
|
|
expect_value("${content}" "1.2.3" "version")
|
|
expect_value("${content}" "1.2.0" "compat_version")
|
|
expect_value("${content}" "simple" "version_schema")
|
|
|
|
expect_array("${content}" 1 "default_components")
|
|
expect_value("${content}" "foo" "default_components" 0)
|
|
|
|
expect_array("${content}" 2 "configurations")
|
|
expect_value("${content}" "release" "configurations" 0)
|
|
expect_value("${content}" "debug" "configurations" 1)
|