KWSys: Fix SystemTools::FileIsDirectory with long paths (#14176)

Allocate a buffer large enough to hold the input path when removing a
trailing slash.  Use a local stack buffer when it is large enough and
fall back to heap allocation otherwise.
Merge branch 'master' into fix-FileIsDirectory-SEGV

Resolve conflict in Source/kwsys/SystemTools.cxx by combining the two
changes.
if: Add test for IS_DIRECTORY

Add a RunCMake.if test to cover if() command behavior.  Start with a
test for IS_DIRECTORY cases with an existing directory and a long path,
both with a trailing slash.
KWSys 2013-05-29 (725e541e)

Extract upstream KWSys using the following shell commands.

$ git archive --prefix=upstream-kwsys/ 725e541e | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' f4928d44..725e541e
Brad King (1):
      9fd64779 SystemTools: Fix FileIsDirectory with long paths

Rolf Eike Beer (3):
      e8269442 Tests: fix a warning with acc
      87abd647 SystemInformation: fix truncation warnings
      039d9598 fix warnings about sizeof() return value truncation

Change-Id: I1c459346a622610eac62dfcd3abd0e73c5a83494
Merge branch 'upstream-kwsys' into update-kwsys
Merge topic 'update-kwsys'

2c0c59a Merge branch 'upstream-kwsys' into update-kwsys
9270129 KWSys 2013-05-29 (725e541e)
Merge topic 'fix-FileIsDirectory-SEGV'

7378792 if: Add test for IS_DIRECTORY
4ab10e0 Merge branch 'master' into fix-FileIsDirectory-SEGV
045d6ae KWSys: Fix SystemTools::FileIsDirectory with long paths (#14176)