UseSWIG.cmake SWIG_OUTFILE_DIR variable sets a directory name (not the output filename)
Modules/UseSWIG.cmake:46
# SWIG_OUTFILE_DIR allows one to specify where to write the output file
# (swig -o option). If not specified, CMAKE_SWIG_OUTDIR is used.
swig -o option (SWIG Version 4.0.0):
-o <outfile> - Set name of C/C++ output file to <outfile>
The output filename always appears to get generated from the swig .i filename.
Example:
set(SWIG_OUTFILE_DIR blibbity.cxx)
set_property(SOURCE blah.i PROPERTY CPLUSPLUS ON)
swig_add_library (module_a LANGUAGE python SOURCES blah.i)
Generates an empty output cxx:
CMakeFiles/_module_a.dir/blibbity.cxx
while UseSWIG.cmake expects a blahPYTHON_wrap.cxx in another location:
swig_generated_file_fullname=blibbity.cxx/blahPYTHON_wrap.cxx
A possible solution would be for UseSWIG.cmake to accept both SWIG_OUTFILE_DIR and SWIG_OUTFILE_NAME.