Files
CMake/Tests/RunCMake/ExportImport/SpdxLicenseProperty-import.cmake
T
Daniel Tierney df3e246bc1 export: Import/export target property for license
Add import/export support and documentation for the SPDX_LICENSE
target property. A target's license can be specified by setting
this property to an SPDX license expression. CMake and CPS-format
export files generated with `export()` or `install()` will
retain the license information. CMake also imports the license
property for imported targets.

Closes: #26706
2025-05-13 17:01:20 -04:00

7 lines
270 B
CMake

find_package(foo REQUIRED CONFIG NO_DEFAULT_PATH)
get_property(SPDX_LICENSE TARGET foo PROPERTY SPDX_LICENSE)
if(NOT SPDX_LICENSE STREQUAL "BSD-3-Clause")
message(FATAL_ERROR
"Expected SPDX_LICENSE property to be 'BSD-3-Clause' but got '${SPDX_LICENSE}'")
endif()