LIBCPP_VERSION_OUTPUT breaks cross-compilation and is not used anywhere
envgap__nlohmann__json-4863
01 / FAILURE SIGNATURE
As reported upstream
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
c637a8b453dfc772f7819eb373af1c683c522635- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
nlohmann/json #4863 · read the original issue
### Description I'm cross-building this project for target architecture RISC-V on the build x86_64. CMake configuration process fails on the first run while trying to detect C++ library version, but the second run of cmake passes without errors and reports C++ library as "Unknown". Investingating this issue shows that the variable LIBCPP_VERSION_OUTPUT has been introduced in the commit 281d1e929bd7c4b694d8c193526bfb0b6577108f and is not used anywhere. ### Reproduction steps cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=/path/to/your/cross/cmake-toolchain-files/riscv64-linux-gcc.cmake -DCMAKE_BUILD_TYPE=Release ### Expected vs. actual results Expected results: cross-building is passes at the first run Actual results: cross-building is passes at the second run ### Minimal code example ```Shell ``` ### Error messages ```Shell On the first run: CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately: RUN_RESULT_VAR (advanced) RUN_RESULT_VAR__TRYRUN_OUTPUT (advanced) On the second run: Clean cmake config without errors ``` ### Compiler and operating system cmake version: 3.31.6 os: Ubuntu 25.04 ### Library version d33ecd3f3bd11e30aa8bbabb00e0a9cd3f2456d8 ### Validation - [x] The bug also occurs if the latest version from the [`develop`](https://github.com/nlohmann/json/tree/develop) branch is used. - [ ] I can successfully [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests).
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]