I have the following sample project which I would like to export PROTOCOLS_LIST
properties.
cmake_minimum_required(VERSION 3.14.0)
project(exported_props LANGUAGES CXX)
add_library(protocols ...)
set_target_properties(protocols PROPERTIES PROTOCOLS_LIST "IP" "TCP" "UDP")
install(TARGETS protocols EXPORT protocol)
install(EXPORT protocol DESTINATION ${CMAKE_BINARY_DIR})
When installing the above sample code, the created protocol.cmake
file will not contain my custom property PROTOCOLS_LIST
.
Is it possible to pass some target's properties when installing TARGETS?
By default, CMake installs only specific set of target's properties.
For tell CMake to install additional properties you could list that properties in the EXPORT_PROPERTIES target's property:
# Tell CMake to install PROTOCOLS_LIST property for the target.
set_property(TARGET protocols APPEND PROPERTY EXPORT_PROPERTIES PROTOCOLS_LIST)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With