mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-05 14:49:39 -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.
16 lines
519 B
CMake
16 lines
519 B
CMake
add_library(foo INTERFACE)
|
|
|
|
target_compile_features(foo INTERFACE cxx_std_23)
|
|
target_compile_options(foo INTERFACE -ffast-math)
|
|
target_compile_definitions(foo INTERFACE -DFOO -DBAR=BAR)
|
|
target_include_directories(
|
|
foo INTERFACE
|
|
$<INSTALL_INTERFACE:include/foo>
|
|
)
|
|
target_link_directories(foo INTERFACE /opt/foo/lib)
|
|
target_link_options(foo INTERFACE --needed)
|
|
target_link_libraries(foo INTERFACE /usr/lib/libm.so)
|
|
|
|
install(TARGETS foo EXPORT foo DESTINATION .)
|
|
install(PACKAGE_INFO foo DESTINATION cps EXPORT foo)
|