From 58dd889165150d00cfd52fed64e83dcd4c973864 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 5 Dec 2018 18:55:55 -0700 Subject: [PATCH] CMake: Simplify Interrogate.cmake's add_python_module() keyword handling --- cmake/macros/Interrogate.cmake | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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()