Running configure_*, allow $CMAKE to override cmake.
Use empirical test to judge whether a directory is accessible.

From htcondor-users:
* On 11 Mar 2013, Jaime Frey wrote:
> On Mar 5, 2013, at 9:29 AM, Jason Ferrara <jason.ferrara@jacquette.com> wrote:
>
> > We've been having issues where a user would submit a job, and condor_submit would respond with
> >
> > ERROR: No such directory: <path to initialdir>
> >
> > even though the directory pointed to by initialdir does exist and the user has full read/write/execute permission for it.
> >
> > To check for access to initialdir, condor_submit calls check_iwd, which calls access_euid, which calls access_euid_dir.
> > access_euid_dir checks if the effrective uid or gid has access by manually checking permission bits, but it doesn't check secondary
> > groups or ACLs, so the access check can fail even if the user really does have access. Also, check_iwd always prints "No such
> > directory", even if the failure is caused by lack of write permission to the directory.

> >
> > Replacing all calls to access_euid with the system provided euidaccess seems to fix the problem. Is this the right thing to do?
>
> That does sound like the right thing to do, where euidaccess() is available. I'll make an entry in our bug tracking system, though I
> can't say when we'll get a chance to make the change and test it.

This is catching users in OSG Connect, so I'd like to see a fix.
euidaccess() (eaccess()) is a GNU extension, and pretty unportable.

access_euid_dir() amounts to this rule:

* if testing R_OK, attempt to open the directory to read
* if testing W_OK, attempt to create a file in the directory (i.e. write the directory)
* if testing X_OK, do a bunch of tests against euid and egid, neglecting supplementary groups and POSIX ACLs.

That is, R_OK and W_OK use empirical tests, while X_OK attempts to
emulate the logic of the kernel.  Why not have the X_OK test simply
attempt chdir() to the directory?  For example: