opentx: fix build with cmake4

This commit is contained in:
Rafael Ieda
2025-10-26 05:33:43 -03:00
parent 5015b62b31
commit 872f3028e4
2 changed files with 37 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ mkDerivation rec {
sha256 = "sha256-F3zykJhKuIpLQSTjn7mcdjEmgRAlwCZpkTaKQR9ve3g=";
};
patches = [
# fix error "The LOCATION property may not be read from target" and ensure proper linking of Qt modules so build don't fail
./fix-cmake-qt-linking-and-location.patch
];
nativeBuildInputs = [
cmake
gcc-arm-embedded
@@ -44,6 +48,12 @@ mkDerivation rec {
sed -i companion/src/burnconfigdialog.cpp \
-e 's|/usr/.*bin/dfu-util|${dfu-util}/bin/dfu-util|' \
-e 's|/usr/.*bin/avrdude|${avrdude}/bin/avrdude|'
substituteInPlace CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 2.8)" "cmake_minimum_required(VERSION 3.10)" \
--replace-fail "cmake_policy(SET CMP0023 OLD)" "cmake_policy(SET CMP0023 NEW)"
substituteInPlace companion/src/thirdparty/maxlibqt/src/widgets/CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 2.8.12)" "cmake_minimum_required(VERSION 3.10)"
'';
cmakeFlags = [

View File

@@ -0,0 +1,27 @@
--- a/companion/src/CMakeLists.txt
+++ b/companion/src/CMakeLists.txt
@@ -313,8 +313,8 @@
qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${icon_RC})
-target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit qcustomplot shared ${CPN_COMMON_LIB})
-
+target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit qcustomplot shared ${CPN_COMMON_LIB}
+Qt5::Network Qt5::PrintSupport)
PrintTargetReport("${COMPANION_NAME}")
############# Standalone simulator ###############
@@ -371,11 +371,11 @@
string(TOLOWER ${PCB} FLAVOUR)
endif()
if(POLICY CMP0026)
- cmake_policy(SET CMP0026 OLD) # https://cmake.org/cmake/help/v3.0/policy/CMP0026.html
+ cmake_policy(SET CMP0026 NEW) # https://cmake.org/cmake/help/v3.0/policy/CMP0026.html
endif()
if(SIMU_TARGET)
- get_property(current_plugin TARGET opentx-${FLAVOUR}-simulator PROPERTY LOCATION)
+ set(current_plugin $<TARGET_FILE:opentx-${FLAVOUR}-simulator>)
list(APPEND simulator_plugins "${current_plugin}")
endif()