aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Ratiu <adrian.ratiu@collabora.com>2021-08-26 17:44:11 +0300
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-08-31 19:19:05 +0000
commit61e66c37abb1b7f59726e4407ac8dd53e6b75cac (patch)
treef8d2bb1d8b56b4d917df5eb3b0d500511554cd46
parent49240e23b4cf890df67d81d1900f313d1193db8c (diff)
cmake: lemon: allow overriding lemon CC setting
When cross-compiling wireshark the lemon tool should be built using the host machine compiler to be run on the host. Before cmake this was done via autotools CC_FOR_BUILD but cmake only supports one compiler toolchain per build and requires some workarounds like running cmake twice using separately defined toolchains. This gets ugly and complicated fast when considering multiple toolchains, especially for a simple tool like lemon, so just allow builds to override the C compiler and wipe the cflags. This way systems like Gentoo/ChromeOS/Yocto with a properly setup cross-compile environment can just point to the native BUILD_CC or similar while minimizing complexity.
-rw-r--r--tools/lemon/CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lemon/CMakeLists.txt b/tools/lemon/CMakeLists.txt
index af62d4596e..8742aa9fc9 100644
--- a/tools/lemon/CMakeLists.txt
+++ b/tools/lemon/CMakeLists.txt
@@ -9,6 +9,11 @@
add_executable(lemon lemon.c)
+if(DEFINED LEMON_C_COMPILER)
+ set(CMAKE_C_COMPILER "${LEMON_C_COMPILER}")
+ set(CMAKE_C_FLAGS "")
+endif()
+
# To keep lemon.c as close to upstream as possible, deliberately ignore
# some stylistic issues.
set(lemon_cflags)