summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-09-23 03:29:36 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2022-09-23 03:39:22 -0400
commit07f428dc8a0c3855f8b4de960ee7f19d7c81b6d6 (patch)
tree4e19fce1ecb71c2682652f1a868a899e10e83ab4
parent5e820e47a24349630c8b298da2fa45693214d09c (diff)
downloadlighttpd-git-07f428dc8a0c3855f8b4de960ee7f19d7c81b6d6.tar.gz
[cmake] compile lemon with native cc for x-compile
compile lemon with native cc when cross-compiling github: closes #117
-rw-r--r--src/CMakeLists.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index afef25ce..1b52fa4c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -879,7 +879,17 @@ if(WIN32)
set(COMMON_SRC ${COMMON_SRC} xgetopt.c)
endif()
-add_executable(lemon lemon.c)
+if(CMAKE_CROSSCOMPILING)
+ # custom compile lemon using native compiler
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lemon
+ COMMAND cc
+ ARGS ${CMAKE_CURRENT_SOURCE_DIR}/lemon.c -o ${CMAKE_CURRENT_BINARY_DIR}/lemon
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lemon.c
+ COMMENT "Generating lemon from lemon.c using native compiler"
+ )
+else()
+ add_executable(lemon lemon.c)
+endif()
## Build parsers by using lemon...
lemon_parser(configparser.y)