UseSWIG no longer supports swig interface files of the same name in different directories
Commit 2ee10119 adds a add_add_custom_target which uses the swig interface file name:
Modules/UseSWIG.cmake:
+ add_custom_target(${swig_gen_target} DEPENDS ${swig_generated_timestamp})
swig_gen_target comes from each file in swig_dot_i_sources. So a project tree with multiple swig interface files of the same name (but different hierarchy) will all attempt to add a custom target of the same name (gen_commonPYTHON_wrap).
Example dir structure:
.
├── a
│ ├── CMakeLists.txt
│ └── common.i
└── b
├── CMakeLists.txt
└── common.i
This issue is somewhat related to #17703 (closed) since it's possible that providing a means to set the generated output filename may work around this (via swig -o, if UseSWIG.cmake would keep track of the custom generated filename).
Edited by Brad King