Browse Source

CMake: Update add_python_module to support COMPONENT

Sam Edwards 7 years ago
parent
commit
8b6a2cfd09
1 changed files with 7 additions and 2 deletions
  1. 7 2
      cmake/macros/Interrogate.cmake

+ 7 - 2
cmake/macros/Interrogate.cmake

@@ -250,6 +250,7 @@ function(add_python_module module)
   endif()
 
   set(targets)
+  set(component "Python")
   set(link_targets)
   set(import_flags)
   set(infiles_rel)
@@ -259,7 +260,7 @@ function(add_python_module module)
 
   set(keyword)
   foreach(arg ${ARGN})
-    if(arg STREQUAL "LINK" OR arg STREQUAL "IMPORT")
+    if(arg STREQUAL "LINK" OR arg STREQUAL "IMPORT" OR arg STREQUAL "COMPONENT")
       set(keyword "${arg}")
     elseif(keyword STREQUAL "LINK")
       list(APPEND link_targets "${arg}")
@@ -267,6 +268,9 @@ function(add_python_module module)
     elseif(keyword STREQUAL "IMPORT")
       list(APPEND import_flags "-import" "${arg}")
       set(keyword)
+    elseif(keyword STREQUAL "COMPONENT")
+      set(component "${arg}")
+      set(keyword)
     else()
       list(APPEND targets "${arg}")
     endif()
@@ -308,7 +312,8 @@ function(add_python_module module)
     COMMENT "Generating module ${module}"
   )
 
-  add_python_target(panda3d.${module} "${module}_module.cxx" ${sources_abs} ${extensions})
+  add_python_target(panda3d.${module} COMPONENT "${component}" EXPORT "${component}"
+    "${module}_module.cxx" ${sources_abs} ${extensions})
   target_link_libraries(panda3d.${module} ${link_targets})
 
   if(CMAKE_VERSION VERSION_LESS "3.11")