From ebc7bd3da5e1b9c2e6ec2fc3801a38e98f3812ff Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Wed, 15 Jan 2025 14:32:51 -0500 Subject: [PATCH] cmake: do not build tests by default when cross compiling Since we don't install these, it's not useful to attempt to build them when we are cross-compiling. Signed-off-by: Jared Van Bortel --- gpt4all-chat/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index 7d23102cb686..03e771e2dba5 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -24,7 +24,13 @@ endif() find_package(Python3 3.12 QUIET COMPONENTS Interpreter) -option(GPT4ALL_TEST "Build the tests" ${Python3_FOUND}) +if (NOT CMAKE_CROSS_COMPILING AND Python3_FOUND) + set(GPT4ALL_TEST_DEFAULT ON) +else() + set(GPT4ALL_TEST_DEFAULT OFF) +endif() + +option(GPT4ALL_TEST "Build the tests" ${GPT4ALL_TEST_DEFAULT}) option(GPT4ALL_LOCALHOST "Build installer for localhost repo" OFF) option(GPT4ALL_OFFLINE_INSTALLER "Build an offline installer" OFF) option(GPT4ALL_SIGN_INSTALL "Sign installed binaries and installers (requires signing identities)" OFF)