From ed1c66a41517d6a0d19d8f62acbf7b00bd734b1f Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Tue, 9 Jul 2024 13:55:13 +0200 Subject: [PATCH] Fix handling of tools.build:defines for (Ninja) multi-config CMake The CMake generator-expressions that results from the values given to Conan's `tools.build:defines` configuration will now properly be put into quotes to form a CMake string. (Note: CMake's generator-expressions should never contain any (non-escaped) quotes.) --- conan/tools/cmake/toolchain/blocks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan/tools/cmake/toolchain/blocks.py b/conan/tools/cmake/toolchain/blocks.py index 0d65857182b..425e62b2af3 100644 --- a/conan/tools/cmake/toolchain/blocks.py +++ b/conan/tools/cmake/toolchain/blocks.py @@ -724,7 +724,7 @@ class ExtraFlagsBlock(Block): {% if defines %} {% if config %} {% for define in defines %} - add_compile_definitions($<$:"{{ define }}">) + add_compile_definitions("$<$:{{ define }}>") {% endfor %} {% else %} add_compile_definitions({% for define in defines %} "{{ define }}"{% endfor %})