[CMAKE] Fix bitcoind cross build for OSX
Summary:
Use CMAKE_<LANG>_FLAGS_INIT (note the _INIT) variables to set the
target. This variable will set the corresponding CMAKE_<LANG>_FLAGS
variable, but is also used to initalize the CMAKE_REQUIRED_FLAGS for
various check_xxx functions such as check_include_file() or
check_symbol_exist(). This fixes the architecture mismatch issue.
Depends on D3031.
Test Plan:
mkdir buildcmake && cd buildcmake cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/OSX.cmake \ -DBUILD_BITCOIN_QT=OFF .. ninja
The build should succeed.
Check the generated src/bitcoind runs on OSX >= 10.8 (tested on OSX
Sierra 10.12.6).
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D3032