diff Resources/CMake/AutoGeneratedCode.cmake @ 1469:bf9b8bfea0e7

more generic EmbedResources.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Jul 2015 14:12:12 +0200
parents efc448de0899
children 100fbe970762
line wrap: on
line diff
--- a/Resources/CMake/AutoGeneratedCode.cmake	Thu Jul 30 10:14:41 2015 +0200
+++ b/Resources/CMake/AutoGeneratedCode.cmake	Thu Jul 30 14:12:12 2015 +0200
@@ -6,17 +6,28 @@
 
 macro(EmbedResources)
   # Convert a semicolon separated list to a whitespace separated string
+  set(SCRIPT_OPTIONS)
   set(SCRIPT_ARGUMENTS)
   set(DEPENDENCIES)
   set(IS_PATH_NAME false)
+
+  # Loop over the arguments of the function
   foreach(arg ${ARGN})
-    if (${IS_PATH_NAME})
-      list(APPEND SCRIPT_ARGUMENTS "${arg}")
-      list(APPEND DEPENDENCIES "${arg}")
-      set(IS_PATH_NAME false)
+    # Extract the first character of the argument
+    string(SUBSTRING "${arg}" 0 1 FIRST_CHAR)
+    if (${FIRST_CHAR} STREQUAL "-")
+      # If the argument starts with a dash "-", this is an option to
+      # EmbedResources.py
+      list(APPEND SCRIPT_OPTIONS ${arg})
     else()
-      list(APPEND SCRIPT_ARGUMENTS "${arg}")
-      set(IS_PATH_NAME true)
+      if (${IS_PATH_NAME})
+        list(APPEND SCRIPT_ARGUMENTS "${arg}")
+        list(APPEND DEPENDENCIES "${arg}")
+        set(IS_PATH_NAME false)
+      else()
+        list(APPEND SCRIPT_ARGUMENTS "${arg}")
+        set(IS_PATH_NAME true)
+      endif()
     endif()
   endforeach()
 
@@ -28,6 +39,7 @@
     COMMAND 
     ${PYTHON_EXECUTABLE}
     "${ORTHANC_ROOT}/Resources/EmbedResources.py"
+    ${SCRIPT_OPTIONS}
     "${AUTOGENERATED_DIR}/EmbeddedResources"
     ${SCRIPT_ARGUMENTS}
     DEPENDS