Is your feature request related to a problem? Please describe.
Context: Downstream projects may want to consume MatX as a CMake subproject and then install the MatX component for redistribution. Holoscan SDK retrieves and builds with MatX with FetchContent (via rapids_cpm_find) and then embeds MatX headers in resulting binary packages for developer convenience. (See link)
Issue: MatX today does not support generating "matx-config.cmake" if MatX is consumed as a subproject in some external build. Config file logic is gated behind the MatX NOT_SUBPROJECT variable here.
Describe the solution you'd like
Allow the developer to set explicitly whether MatX CMake config files should be generated, falling back to previous behavior as needed.
Implementation suggestion by @jcfr:
if (NOT DEFINED MATX_GENERATE_CONFIG)
# Generate config files if the user isn't adding this as a subdirectory. At this point our transitive target
# should have all build properties needed based on the options passed in.
set(MATX_GENERATE_CONFIG ${PROJECT_IS_TOP_LEVEL})
endif()
Describe alternatives you've considered
Workaround: Patch MatX CMakeLists.txt in downstream FetchContent to override NOT_SUBPROJECT behavior.
Is your feature request related to a problem? Please describe.
Context: Downstream projects may want to consume MatX as a CMake subproject and then install the MatX component for redistribution. Holoscan SDK retrieves and builds with MatX with FetchContent (via rapids_cpm_find) and then embeds MatX headers in resulting binary packages for developer convenience. (See link)
Issue: MatX today does not support generating "matx-config.cmake" if MatX is consumed as a subproject in some external build. Config file logic is gated behind the MatX
NOT_SUBPROJECTvariable here.Describe the solution you'd like
Allow the developer to set explicitly whether MatX CMake config files should be generated, falling back to previous behavior as needed.
Implementation suggestion by @jcfr:
Describe alternatives you've considered
Workaround: Patch MatX CMakeLists.txt in downstream
FetchContentto overrideNOT_SUBPROJECTbehavior.