1*4882a593SmuzhiyunFrom bb4a8937411a9e6ac2e5c12c0e7eeaa7dab251ba Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3*4882a593SmuzhiyunDate: Sat, 5 Sep 2020 12:54:21 +0200 4*4882a593SmuzhiyunSubject: [PATCH] CMakeLists.txt: allow building without a C++ compiler 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunDefine hiredis as a C project (and use a single PROJECT statement) to 7*4882a593Smuzhiyunavoid the following build failure if a C++ compiler is not found: 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunCMake Error at CMakeLists.txt:3 (PROJECT): 10*4882a593Smuzhiyun The CMAKE_CXX_COMPILER: 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun /srv/storage/autobuild/run/instance-1/output-1/host/bin/arm-linux-g++ 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun is not a full path to an existing compiler tool. 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun Tell CMake where to find the compiler by setting either the environment 17*4882a593Smuzhiyun variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path 18*4882a593Smuzhiyun to the compiler, or to the compiler name if it is in the PATH. 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunThe only cpp source file is examples/example-qt.cpp which is never 21*4882a593Smuzhiyuncompiled with cmake buildsystem. This file is compiled only with the 22*4882a593SmuzhiyunMakefile buildsystem so perhaps it should be removed. If it is added to 23*4882a593Smuzhiyunthe cmake buildsystem, a call to enable_language(CXX) will have to be 24*4882a593Smuzhiyunadded. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunFixes: 27*4882a593Smuzhiyun - http://autobuild.buildroot.org/results/830ec3398cd29b9fc5cde06a225ef531d7a9d850 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 30*4882a593Smuzhiyun[Upstream status: https://github.com/redis/hiredis/pull/872] 31*4882a593Smuzhiyun--- 32*4882a593Smuzhiyun CMakeLists.txt | 3 +-- 33*4882a593Smuzhiyun 1 file changed, 1 insertion(+), 2 deletions(-) 34*4882a593Smuzhiyun 35*4882a593Smuzhiyundiff --git a/CMakeLists.txt b/CMakeLists.txt 36*4882a593Smuzhiyunindex 4cbd438..9d65b7f 100644 37*4882a593Smuzhiyun--- a/CMakeLists.txt 38*4882a593Smuzhiyun+++ b/CMakeLists.txt 39*4882a593Smuzhiyun@@ -1,6 +1,5 @@ 40*4882a593Smuzhiyun CMAKE_MINIMUM_REQUIRED(VERSION 3.4.0) 41*4882a593Smuzhiyun INCLUDE(GNUInstallDirs) 42*4882a593Smuzhiyun-PROJECT(hiredis) 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) 45*4882a593Smuzhiyun OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) 46*4882a593Smuzhiyun@@ -20,7 +19,7 @@ getVersionBit(HIREDIS_SONAME) 47*4882a593Smuzhiyun SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}") 48*4882a593Smuzhiyun MESSAGE("Detected version: ${VERSION}") 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun-PROJECT(hiredis VERSION "${VERSION}") 51*4882a593Smuzhiyun+PROJECT(hiredis LANGUAGES "C" VERSION "${VERSION}") 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun # Hiredis requires C99 54*4882a593Smuzhiyun SET(CMAKE_C_STANDARD 99) 55*4882a593Smuzhiyun-- 56*4882a593Smuzhiyun2.28.0 57*4882a593Smuzhiyun 58