Generally for a module foo, SWIG generates (in Python mode)
an extension module _foo.so and a proxy Python module foo.py.
However, if -noproxy is specified, instead it builds only foo.so
(without the leading underscore). The custom command generated
by CMake correctly handles the removal of this underscore when
-noproxy is given; however, it still adds foo.py to the expected
outputs. This upsets build tools that expect foo.py to be generated
(for example, 'make' will run the SWIG command twice). Fix this
by removing foo.py from the set of extra generated files when
-noproxy is specified.
This reverts commit 242c3966 (add_custom_command: Diagnose
MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit
b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands,
2015-03-26).
I misdiagnosed the underlying issue that prompted creation of policy CMP0057.
The actual issue surfaces when a single custom command's MAIN_DEPENDENCY
is listed in more than one target; this issue will have to be addressed
independently.
When SWIG_GET_EXTRA_OUTPUT_FILES checks to see if a source file exists
for use in reading the module name, it must pass an absolute path to
the if(EXISTS) command. Teach SWIG_ADD_SOURCE_TO_MODULE to give it
the absolute path it already knows.
Add the dependency on the main swig input source file as a normal
DEPENDS option. We cannot use MAIN_DEPENDENCY because if there are
multiple target languages then multiple custom commands would want to
use the same MAIN_DEPENDENCY, but at most one custom command may specify
a given source file as its MAIN_DEPENDENCY. Exposed by a CMP0057
warning.
Protect against variables named "CSHARP", "PERL", "PYTHON", or "UNKNOWN"
when CMP0054 is not set to NEW.
Reported-by: Tuukka Pasanen <tuukka@iocaste.ilmi.fi>
The check for this flag added by commit v3.0.0-rc1~284^2 (UseSWIG: Name
python module according to swig flags, 2013-11-26) can get false
positives on flags like "-noproxydel". Improve the check to match only
"-noproxy".
Suggested-by: Garth Wells <gnw20@cam.ac.uk>
There are many style errors in these files. This patch fixes only
the syntactical errors.
The script which ported these to rst tripped on some incorrectly
formatted blocks in the original input documentation. Use a new
script to find problematic code (and then fix them manually):
#!/usr/bin/env python
import os
rootDir = '.'
def checkFile(fname):
f = open(fname)
lines = f.readlines()
started = False
counter = 0
for l in lines:
if "#" in l:
started = True
elif started:
return
lin = l.find("(")
if lin != -1 and l.find(")", lin) == -1 and \
not "(To distribute this file outside of CMake, substitute the full" in l:
for lp in lines[counter+1:]:
if lp == "# ::\n":
print "\n\n######### " + fname + "\n\n"
print ''.join(lines[max(counter-2, 0):counter+6])
break
elif lp == "#\n" :
continue
break
counter += 1
for dirName, subdirList, fileList in os.walk(rootDir):
for fname in fileList:
checkFile(os.path.join(dirName, fname))
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block. This is no longer the preferred style.
Run the following shell code:
for c in else endif endforeach endfunction endmacro endwhile; do
echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
This reverts commit 1088b0278e.
Wrapper dependency scanning (fix for #4147) does not work at CMake
configuration time if an input file is provided by a custom command
(regression #12307). Revert to original behavior until a solution is
found.
This commit fixes BUG: 0011782. UseSWIG would be using the same variable
to declare module information. The problem would only be noticed in parallel builds
Fix this variable declaration by properly resetting it.
This commit fixes BUG: 0011215 by properly expanding $(OutDir)
Instead of creating the output directory using file(MAKE_DIRECTORY)
we use cmake -E to create the directory at execution time
This commit fixes BUG: 0004147 it directly uses swig executable
to compute a list of dependencies directly from the .i files
to make sure to rebuild the swig module any of its direct dep.
is touched
This adds copyright/license notification blocks CMake's non-find
modules. Most of the modules had no notices at all. Some had notices
referring to the BSD license already. This commit normalizes existing
notices and adds missing notices.