From 9e0b2ab71475a5d810c8cdc267958e5dd2b862a9 Mon Sep 17 00:00:00 2001 From: Derrek Landauer Date: Mon, 25 Sep 2023 10:29:58 -0600 Subject: [PATCH] Fixes cross compiler issues (#1512) Actions: Modified CMakeLists to check if CMAKE_CXX_COMPILER is set first. Side effect: tests now fail if object is not compiled for host arch. Possible side effect mitgations: compile for both host and target architectures. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cac788..93f804d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,9 @@ option(BUILD_WITH_CXX_11 "Build jsoncpp_lib with C++11 standard." ON) ## To compatible with C++0x and C++1x set(CMAKE_MINIMUN_CXX_STANDARD 98) if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_COMPILER "/usr/bin/g++") + if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER "/usr/bin/g++") + endif() execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CXX_VERSION) if(CXX_VERSION VERSION_GREATER 4.8.0) if(BUILD_WITH_CXX_11)