Source: ksyntax-highlighting
Version: 5.115.0-2
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

ksyntax-highlighting fails to cross build from source, because it passes
host compiler flags (e.g. -mbranch-protection=standard when building for
arm64) to the build architecture compiler (when run via an
ExternalProject_Add for builing a native helper e.g. for amd64) and the
compiler doesn't like that. This is matter is notoriously difficult in
CMake, because we communicate the compiler via command line arguments
and the compiler flags via environment. The compiler needs explicit
forwarding to external projects and has been intentionally omitted here
whereas the flags are implicitly forwarded and need to be explicitly set
here. I'm attaching a patch that is joint work with Timo Roehling for
passing the right flags for the external project.

Helmut
--- ksyntax-highlighting-5.115.0.orig/src/indexer/CMakeLists.txt
+++ ksyntax-highlighting-5.115.0/src/indexer/CMakeLists.txt
@@ -20,6 +20,8 @@
                             -DECM_DIR=${ECM_DIR} -DCMAKE_PREFIX_PATH=${NATIVE_PREFIX}
                             -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
                             -DQT_MAJOR_VERSION=${QT_MAJOR_VERSION}
+			    "-DCMAKE_C_FLAGS=$ENV{CFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD}"
+			    "-DCMAKE_CXX_FLAGS=$ENV{CXXFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD}"
                         INSTALL_COMMAND ""
                         BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/native_katehighlightingindexer-prefix/src/native_katehighlightingindexer-build/bin/katehighlightingindexer
                     )

Reply via email to