openscenegraph / OpenSceneGraph

OpenSceneGraph git repository
http://www.openscenegraph.org
Other
3.25k stars 1.42k forks source link

[cmake] Fix cross-build failure #1164

Closed JackBoosY closed 2 years ago

JackBoosY commented 2 years ago

When I cross-build osg for arm64-windows with x64-windows, I got the following cmake error message:

CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED_EXITCODE (advanced)
   _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see D:/buildtrees/osg/arm64-windows-rel/TryRunResults.cmake

According to the cmake code generated by cmake automaticly, add the same code before call CHECK_CXX_SOURCE_RUNS.

cmake version: 3.24 osg version: 3.6.5 OS version: Windows 10 compiler version: Visual Studio 2017

dg0yt commented 2 years ago

IMO this PR is completely invalid. However, the original problem is valid: all uses of try_run or check_cxx_source_runs are a barrier for cross builds. https://github.com/openscenegraph/OpenSceneGraph/search?q=CHECK_CXX_SOURCE_RUNS