Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use of CMAKE_BUILD_TYPE to set compiler options/defines is incompatible with multi-config generators #19

Closed
abdes opened this issue Sep 18, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@abdes
Copy link
Owner

abdes commented Sep 18, 2022

See Build Configurations for more details.

In several places, there is still code that checks CMAKE_BUILD_TYPE to set specific compiler flags or defines. Such code is problematic:

Generator expressions should be used instead to handle configuration-specific logic correctly, regardless of the generator used. For example:

# Works correctly for both single and multi-config generators
target_compile_definitions(exe1 PRIVATE
  $<$<CONFIG:Debug>:DEBUG_BUILD>
)
@abdes abdes added the bug Something isn't working label Sep 18, 2022
@abdes abdes self-assigned this Sep 18, 2022
@abdes abdes closed this as completed in 857d299 Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant