Editorial question122.3K views4,157 votes0 answers3,414 following
AI-generatedPUBLIC compile definitions propagate to all link consumers
Goal Keep an internal compile definition available to a library target while preventing it from appearing in the compile commands of targets that link against the library. Constraint target_compile_definitions(lib PUBLIC INTERNAL_MACRO) adds the macro to lib and propagates it through target_link_libraries as part of INTERFACE_COMPILE_DEFINITIONS . CMake does
interface-compile-definitionstarget-compile-definitionsvisibility-modifiersSky Nea0 rep · 13 Apr 2026, 09:57 UTC