52 lines
2.5 KiB
Diff
52 lines
2.5 KiB
Diff
Handle cross build support for kconfig_compiler and kconf_update tools.
|
|
|
|
Adapted from this patch:
|
|
https://build.opensuse.org/package/view_file/home:rhabacker:branches:windows:mingw:win32:KF529/mingw32-kconfig/0001-Add-MinGW32-cross-compile-support-to-kconfig_compile.patch
|
|
|
|
Contrary to reference above, paths to these tools are hardcoded in this package.
|
|
If not, packages that depend on it will have to indicate each binary "native" paths in case
|
|
of cross-build, since these cmake directive lines are always evalued at *their* build time.
|
|
|
|
--- a/KF5ConfigConfig.cmake.in
|
|
+++ b/KF5ConfigConfig.cmake.in
|
|
@@ -11,5 +11,13 @@ if(CMAKE_CROSSCOMPILING AND KF5_HOST_TOOLING)
|
|
include("${KCONFIGCOMPILER_PATH}")
|
|
else()
|
|
include("${CMAKE_CURRENT_LIST_DIR}/KF5ConfigCompilerTargets.cmake")
|
|
+ if(CMAKE_CROSSCOMPILING)
|
|
+ set_target_properties(KF5::kconfig_compiler PROPERTIES IMPORTED_LOCATION_NONE /usr/libexec/kf5/kconfig_compiler_kf5)
|
|
+ set_target_properties(KF5::kconfig_compiler PROPERTIES IMPORTED_LOCATION /usr/libexec/kf5/kconfig_compiler_kf5)
|
|
+ endif()
|
|
+ if(CMAKE_CROSSCOMPILING)
|
|
+ set_target_properties(KF5::kconf_update PROPERTIES IMPORTED_LOCATION_NONE /usr/libexec/kf5/kconf_update)
|
|
+ set_target_properties(KF5::kconf_update PROPERTIES IMPORTED_LOCATION /usr/libexec/kf5/kconf_update)
|
|
+ endif()
|
|
endif()
|
|
include("${CMAKE_CURRENT_LIST_DIR}/KF5ConfigMacros.cmake")
|
|
--- a/KF5ConfigMacros.cmake
|
|
+++ b/KF5ConfigMacros.cmake
|
|
@@ -89,8 +89,12 @@
|
|
endif()
|
|
|
|
# the command for creating the source file from the kcfg file
|
|
+ set(KCONFIG_COMPILER_LOCATION KF5::kconfig_compiler)
|
|
+ if(CMAKE_CROSSCOMPILING)
|
|
+ get_target_property(KCONFIG_COMPILER_LOCATION KF5::kconfig_compiler LOCATION)
|
|
+ endif()
|
|
add_custom_command(OUTPUT ${_header_FILE} ${_src_FILE}
|
|
- COMMAND KF5::kconfig_compiler
|
|
+ COMMAND ${KCONFIG_COMPILER_LOCATION}
|
|
ARGS ${_kcfg_FILE} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR}/${_rel_PATH}
|
|
MAIN_DEPENDENCY ${_tmp_FILE}
|
|
DEPENDS ${_kcfg_FILE})
|
|
--- a/src/kconfig_compiler/CMakeLists.txt
|
|
+++ b/src/kconfig_compiler/CMakeLists.txt
|
|
@@ -12,6 +12,7 @@
|
|
if(BUILD_TESTING)
|
|
message(WARNING "Testing should be disabled on cross-compilation")
|
|
endif()
|
|
+ add_executable(KF5::kconfig_compiler IMPORTED GLOBAL)
|
|
else()
|
|
add_executable(KF5::kconfig_compiler ALIAS kconfig_compiler)
|
|
endif()
|