Fix binary directory used in CMake try_compile commands

Old paths can have problems with cross-compilation
Merge pull request #766 from taka-no-me:try_compile_fix