I have a CMakeLists.txt
file which contains three targets. Two of these targets have target_compile_definitions
which contain long but identical generator expressions. Since I try to adhere to the DRY principle I am wondering if there is a way to avoid code duplication for these generator expressions?
You can do this:
set(genex "$<…>")
target_compile_definitions(a PRIVATE "${genex}")
target_compile_definitions(b PRIVATE "${genex}")
Simpler than expected.
Thank you!