Files
CMake/Tests/RunCMake/ExportPackageInfo/InterfaceProperties.cmake
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

17 lines
580 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
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/foo>
)
target_link_directories(foo INTERFACE /opt/foo/lib)
target_link_options(foo INTERFACE --needed)
target_link_libraries(foo INTERFACE /usr/lib/libm.so)
set_property(TARGET foo PROPERTY SPDX_LICENSE "BSD-3-Clause")
install(TARGETS foo EXPORT foo DESTINATION .)
export(EXPORT foo PACKAGE_INFO foo)