When unit tests and an exported library shall be compiled with identical _private_ settings (include directories, compiler flags etc.), I see these options:
(1) define variables to be passed to target_* functions for both library and test target + simple solution - violates avoid-variables-idiom - possibly uses "non-local" variables defined in another CMakeLists.txt (reduces readability)
(2) link both library and test targets against an internal, usage-requirement-only interface library + modern approach, no variables, only target_* functions invoked - when compiling a static library, the internal target must be exported, too (though "filtered" by LINK_ONLY later on)
(3) retrieve lib properties via get_property, then propagate them via target_* functions + variables in use have a "local" scope of the CMakeLists.txt - verbose and clumsy
Am I missing a solution? Which one is preferable and why? Any pro/cons that I haven't seen?