fontanf
fontanf

Reputation: 249

Add compile option from dependency to the whole project

My project A depends on B and C. B and C are included in A through FetchContent.

Project B contains compiled libraries that require the whole project to be compiled with:

    add_compile_options(
        $<$<CONFIG:>:/MT>
        $<$<CONFIG:Debug>:/MTd>
        $<$<CONFIG:Release>:/MT>)

That means that project A and project C must be compiled with these options as well.

Therefore, if I use target_compile_options on targets from B, it doesn't work.

For now, it works if I set this in A. But I have other projects that depend on B. So it would seem better to me to set something in B instead of A.

What is the right thing to do here?

Upvotes: 0

Views: 33

Answers (0)

Related Questions