diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index 109ff1037f..1e0134e5ff 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -257,19 +257,16 @@ function(add_python_module module) set(sources_abs) set(extensions) - set(link_keyword OFF) - set(import_keyword OFF) + set(keyword) 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}") - elseif(import_keyword) + set(keyword) + elseif(keyword STREQUAL "IMPORT") list(APPEND import_flags "-import" "${arg}") + set(keyword) else() list(APPEND targets "${arg}") endif()