From 09c690b156cab74aec61f0dbb9fef48f3a1bb074 Mon Sep 17 00:00:00 2001 From: Assad Hashmi Date: Fri, 12 Apr 2019 17:53:20 +0100 Subject: [PATCH] i#3458 cpp pre-processor: Allow users to override default CPP at build time (#3532) This change is required for the stock OpenSUSE Tumbleweed distro on AArch64 --- make/cpp2asm_support.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/make/cpp2asm_support.cmake b/make/cpp2asm_support.cmake index 75f15572284..ebd98aead7f 100644 --- a/make/cpp2asm_support.cmake +++ b/make/cpp2asm_support.cmake @@ -138,10 +138,15 @@ if (UNIX) # and doesn't produce any output, so we must use cpp for our .asm files. # we assume it's in the same dir. get_filename_component(compiler_path ${CMAKE_C_COMPILER} PATH) - find_program(CMAKE_CPP cpp HINTS "${compiler_path}" DOC "path to C preprocessor") - if (NOT CMAKE_CPP) - message(FATAL_ERROR "cpp is required to build") - endif (NOT CMAKE_CPP) + # Allow user to set C pre-processor from environment variable + if (DEFINED ENV{CPP}) + set(CMAKE_CPP $ENV{CPP}) + else () + find_program(CMAKE_CPP cpp HINTS "${compiler_path}" DOC "path to C preprocessor") + if (NOT CMAKE_CPP) + message(FATAL_ERROR "cpp is required to build") + endif (NOT CMAKE_CPP) + endif () mark_as_advanced(CMAKE_CPP) set(CPP_KEEP_COMMENTS -C)