Unverified Commit 872f3028 authored by Rafael Ieda's avatar Rafael Ieda
Browse files

opentx: fix build with cmake4

parent 5015b62b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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 = [
+27 −0
Original line number Diff line number Diff line
--- 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()