Fix CMake warnings on OS X

fixes #7417