mirror of
https://github.com/nlohmann/json.git
synced 2025-11-23 19:34:10 +08:00
* Fix #4863: skip try_run for LIBCPP_VERSION_OUTPUT during cross compilation Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> * fix #4863: handle cross-compiling in libc++ detection gracefully Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> * refactor: move cross-compiling check before cached output detection Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> --------- Signed-off-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local> Co-authored-by: Hitgirl <hitgirl@Hitgirls-MacBook-Air.local>
This commit is contained in:
@@ -68,10 +68,14 @@ string(REGEX REPLACE "[ ]*\n" "; " CXX_VERSION_RESULT "${CXX_VERSION_RESULT}")
|
||||
message(STATUS "Compiler: ${CXX_VERSION_RESULT}")
|
||||
|
||||
# determine used C++ standard library (for debug and support purposes)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(LIBCPP_VERSION_OUTPUT_CACHED "could not be detected due to cross-compiling" CACHE STRING "Detected C++ standard library version")
|
||||
endif()
|
||||
if(NOT DEFINED LIBCPP_VERSION_OUTPUT_CACHED)
|
||||
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||
"${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/cmake/detect_libcpp_version.cpp"
|
||||
RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT
|
||||
RUN_OUTPUT_VARIABLE LIBCPP_VERSION_OUTPUT
|
||||
COMPILE_OUTPUT_VARIABLE LIBCPP_VERSION_COMPILE_OUTPUT
|
||||
)
|
||||
if(NOT LIBCPP_VERSION_OUTPUT)
|
||||
set(LIBCPP_VERSION_OUTPUT "Unknown")
|
||||
|
||||
Reference in New Issue
Block a user