SWIG : get generated filename for installation purposes

I am able to use SWIG+Python in my CMake configuration. The generated and compiled code works.

I am at the stage of installation/packaging.

  set_property(SOURCE src/example.i PROPERTY SWIG_MODULE_NAME example_special) # for illustration only                                                                                  
  swig_add_library(example_special_new LANGUAGE python SOURCES src/example.i src/example.c) # testing with different name to validate that we understand the API                        
  target_link_libraries(example_special_new Python3::Module)

For my target I see a file named “example_special.py” generated, is there a cmake programmatic way to get that filepath or do I rely on convention. I want to add the generated file “example_special.py” as part of my installation.


Answering my own question, I am able to resolve the above with the following.

  get_property(_python_files TARGET example_special_new PROPERTY SWIG_SUPPORT_FILES)
  message("_python_files = ${_python_files}")