Browse Source

Meta: Properly quote some CMake variables in serenity_component

This probably isn't all of them, because I'm no CMake expert. :^)
It does however allow "/bin/false" to build now.
sin-ack 4 years ago
parent
commit
a871a2040b
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Meta/CMake/utils.cmake

+ 5 - 3
Meta/CMake/utils.cmake

@@ -150,8 +150,10 @@ function(serenity_component name)
     set_property(TARGET "Component${name}" PROPERTY SERENITY_COMPONENT_RECOMMENDED ${SERENITY_COMPONENT_RECOMMENDED})
     set_property(TARGET "Component${name}" PROPERTY SERENITY_COMPONENT_REQUIRED ${SERENITY_COMPONENT_REQUIRED})
     set_property(TARGET "Component${name}" PROPERTY SERENITY_COMPONENT_DEPENDS ${SERENITY_COMPONENT_DEPENDS})
-    if(SERENITY_COMPONENT_TARGETS)
-        add_dependencies("Component${name}" ${SERENITY_COMPONENT_TARGETS})
+    if(NOT "${SERENITY_COMPONENT_TARGETS}" STREQUAL "")
+        foreach(target IN LISTS SERENITY_COMPONENT_TARGETS)
+          add_dependencies("Component${name}" "${target}")
+        endforeach()
     endif()
     if(BUILD_EVERYTHING OR BUILD_${NAME_UPPER} OR SERENITY_COMPONENT_REQUIRED)
         add_dependencies(components "Component${name}")
@@ -170,7 +172,7 @@ macro(export_components_helper file_name current_dir)
     get_property(targets DIRECTORY ${current_dir} PROPERTY BUILDSYSTEM_TARGETS)
     foreach(target ${targets})
         get_property(component_name TARGET ${target} PROPERTY SERENITY_COMPONENT_NAME)
-        if(component_name)
+        if(NOT "${component_name}" STREQUAL "")
             get_property(component_name TARGET ${target} PROPERTY SERENITY_COMPONENT_NAME)
             get_property(component_description TARGET ${target} PROPERTY SERENITY_COMPONENT_DESCRIPTION)
             get_property(component_recommended TARGET ${target} PROPERTY SERENITY_COMPONENT_RECOMMENDED)