If the detected OS is FreeBSD, tell LMDB to compile with MDB_DSYNC=O_SYNC instead of the default O_DSYNC, as BSD does not implement this flag.
Also change LMDB Cmake variables to CACHE rather than upgrading them through several parent scopes.