diff Resources/CMake/AutoGeneratedCode.cmake @ 4030:100fbe970762

DANGEROUS commit: removing HAS_EMBEDDED_RESOURCES
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jun 2020 20:50:20 +0200
parents bf9b8bfea0e7
children 78ee0155ec67
line wrap: on
line diff
--- a/Resources/CMake/AutoGeneratedCode.cmake	Tue Jun 09 16:40:43 2020 +0200
+++ b/Resources/CMake/AutoGeneratedCode.cmake	Tue Jun 09 20:50:20 2020 +0200
@@ -11,6 +11,8 @@
   set(DEPENDENCIES)
   set(IS_PATH_NAME false)
 
+  set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
+
   # Loop over the arguments of the function
   foreach(arg ${ARGN})
     # Extract the first character of the argument
@@ -18,7 +20,13 @@
     if (${FIRST_CHAR} STREQUAL "-")
       # If the argument starts with a dash "-", this is an option to
       # EmbedResources.py
-      list(APPEND SCRIPT_OPTIONS ${arg})
+      if (${arg} MATCHES "--target=.*")
+        # Does the argument starts with "--target="?
+        string(SUBSTRING "${arg}" 9 -1 TARGET)  # 9 is the length of "--target="
+        set(TARGET_BASE "${AUTOGENERATED_DIR}/${TARGET}")
+      else()
+        list(APPEND SCRIPT_OPTIONS ${arg})
+      endif()
     else()
       if (${IS_PATH_NAME})
         list(APPEND SCRIPT_ARGUMENTS "${arg}")
@@ -31,7 +39,6 @@
     endif()
   endforeach()
 
-  set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
   add_custom_command(
     OUTPUT
     "${TARGET_BASE}.h"
@@ -40,7 +47,7 @@
     ${PYTHON_EXECUTABLE}
     "${ORTHANC_ROOT}/Resources/EmbedResources.py"
     ${SCRIPT_OPTIONS}
-    "${AUTOGENERATED_DIR}/EmbeddedResources"
+    "${TARGET_BASE}"
     ${SCRIPT_ARGUMENTS}
     DEPENDS
     "${ORTHANC_ROOT}/Resources/EmbedResources.py"
@@ -48,6 +55,6 @@
     )
 
   list(APPEND AUTOGENERATED_SOURCES
-    "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
+    "${TARGET_BASE}.cpp"
     ) 
 endmacro()