Browse Source

CMake: Simplify Interrogate.cmake's add_python_module() keyword handling

Sam Edwards 7 years ago
parent
commit
58dd889165
1 changed files with 7 additions and 10 deletions
  1. 7 10
      cmake/macros/Interrogate.cmake

+ 7 - 10
cmake/macros/Interrogate.cmake

@@ -257,19 +257,16 @@ function(add_python_module module)
   set(sources_abs)
   set(sources_abs)
   set(extensions)
   set(extensions)
 
 
-  set(link_keyword OFF)
-  set(import_keyword OFF)
+  set(keyword)
   foreach(arg ${ARGN})
   foreach(arg ${ARGN})
-    if(arg STREQUAL "LINK")
-      set(link_keyword ON)
-      set(import_keyword OFF)
-    elseif(arg STREQUAL "IMPORT")
-      set(link_keyword OFF)
-      set(import_keyword ON)
-    elseif(link_keyword)
+    if(arg STREQUAL "LINK" OR arg STREQUAL "IMPORT")
+      set(keyword "${arg}")
+    elseif(keyword STREQUAL "LINK")
       list(APPEND link_targets "${arg}")
       list(APPEND link_targets "${arg}")
-    elseif(import_keyword)
+      set(keyword)
+    elseif(keyword STREQUAL "IMPORT")
       list(APPEND import_flags "-import" "${arg}")
       list(APPEND import_flags "-import" "${arg}")
+      set(keyword)
     else()
     else()
       list(APPEND targets "${arg}")
       list(APPEND targets "${arg}")
     endif()
     endif()