mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-23 07:02:13 -06:00
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
17 lines
580 B
CMake
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)
|