From 5847e3d6a83002985ac90ef7de983a7603e32de7 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 17 Apr 2023 15:10:39 +0100 Subject: [PATCH] Juceaide: Pass C and CXX flags during configure when not crosscompiling Similar code was incorrectly removed in 070a6b35e93ca15deed8b059dfa0d491488f0519. When using CLion to invoke CMake, using a Clang toolchain and Ninja, and targeting x64, CLion will pass -m64 in CMAKE_C_FLAGS and CMAKE_CXX_FLAGS. The compilers are passed through to the juceaide build, but the target arch was not, which meant that the linker attempted to link x86 libraries, which failed. --- extras/Build/juceaide/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/Build/juceaide/CMakeLists.txt b/extras/Build/juceaide/CMakeLists.txt index 0af13b72dd..245f47f1b2 100644 --- a/extras/Build/juceaide/CMakeLists.txt +++ b/extras/Build/juceaide/CMakeLists.txt @@ -49,6 +49,8 @@ if(JUCE_BUILD_HELPER_TOOLS) NAMESPACE juce_tools:: FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake") else() + set(extra_compiler_flag_arguments) + # If we're building using the NDK, the gradle wrapper will try to inject its own compiler using # environment variables, which is unfortunate because we really don't want to cross-compile # juceaide. @@ -97,6 +99,10 @@ else() if(DEFINED ENV{PATH_ORIG}) set(ENV{PATH} "$ENV{PATH_ORIG}") endif() + else() + set(extra_compiler_flag_arguments + "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}" + "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}") endif() message(STATUS "Configuring juceaide") @@ -110,6 +116,7 @@ else() "-DCMAKE_BUILD_TYPE=Debug" "-DJUCE_BUILD_HELPER_TOOLS=ON" "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + ${extra_compiler_flag_arguments} WORKING_DIRECTORY "${JUCE_SOURCE_DIR}" OUTPUT_VARIABLE command_output ERROR_VARIABLE command_output