CMake: simplify code in set_additional_compile_definitions
Thanks to the feedback by !
See .
@@ -18,21 +18,16 @@ include (LibAddTest)
function (set_additional_compile_definitions shortname)
# provide the plugin name as string to the compiler/preprocessor
if (NOT "${ARG_COMPILE_DEFINITIONS}" MATCHES "ELEKTRA_PLUGIN_NAME")
- set (ADDITIONAL_COMPILE_DEFINITIONS_PART1 "ELEKTRA_PLUGIN_NAME=\"${shortname}\"")
+ list (APPEND ADDITIONAL_COMPILE_DEFINITIONS_PARTS "ELEKTRA_PLUGIN_NAME=\"${shortname}\"")
endif ()
# provide the plugin name as macro that can be used for building function names, etc.
if (NOT "${ARG_COMPILE_DEFINITIONS}" MATCHES "ELEKTRA_PLUGIN_NAME_C")
- if (ADDITIONAL_COMPILE_DEFINITIONS_PART1)
- set (ADDITIONAL_COMPILE_DEFINITIONS_PART2 ";ELEKTRA_PLUGIN_NAME_C=${shortname}")
- else ()
- set (ADDITIONAL_COMPILE_DEFINITIONS_PART2 "ELEKTRA_PLUGIN_NAME_C=${shortname}")
- endif ()
+ list (APPEND ADDITIONAL_COMPILE_DEFINITIONS_PARTS "ELEKTRA_PLUGIN_NAME_C=${shortname}")
endif ()
- set (ADDITIONAL_COMPILE_DEFINITIONS "${ADDITIONAL_COMPILE_DEFINITIONS_PART1}${ADDITIONAL_COMPILE_DEFINITIONS_PART2}" PARENT_SCOPE)
- unset (ADDITIONAL_COMPILE_DEFINITIONS_PART1)
- unset (ADDITIONAL_COMPILE_DEFINITIONS_PART2)
+ set (ADDITIONAL_COMPILE_DEFINITIONS "${ADDITIONAL_COMPILE_DEFINITIONS_PARTS}" PARENT_SCOPE)
+ unset (ADDITIONAL_COMPILE_DEFINITIONS_PARTS)
endfunction (set_additional_compile_definitions)
# ~~~
