Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22742

CMake: ANDROID_EXTRA_LIBS is not working as list

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • Qt Creator 4.10.0-beta2
    • Android Support
    • None
    • amd64, ubuntu, wayland, sway
    • Android

    Description

      Hi Guys, just realized that if ANDROID_EXTRA_LIBS is filled as LIST in the cmake project - it can't be processed by androiddeployqt, because lib paths of "android-extra-libs" in android_deployment_settings.json will be separated by ";" instead of ",".

      For example:

      • lib/lib1.cmake:
        set(CUSTOM_ANDROID_EXTRA_LIBS ${CUSTOM_ANDROID_EXTRA_LIBS} lib1.so CACHE INTERNAL "")
        
      • lib/lib2.cmake:
        set(CUSTOM_ANDROID_EXTRA_LIBS ${CUSTOM_ANDROID_EXTRA_LIBS} lib2.so CACHE INTERNAL "")
        
      • CMakeLists.txt:
        ...
        include(lib/lib1.cmake)
        include(lib/lib2.cmake)
        ...
        

      Result in android_deployment_settings.json:

      {
          "android-extra-libs": "lib1.so;lib2.so",
      ...
      

       

      Most probably it's expecting a string, but in the qtquickapplication/CMakeLists.txt wizard template:

      set(ANDROID_EXTRA_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so CACHE INTERNAL "")
      

      That gives us:

      "android-extra-libs": "/home/user/Projects/test/path/to/libcrypto.so;/home/user/Projects/test/path/to/libssl.so"
      

       

      I'm using the next workaround for now, but it looks not so good:

      list(APPEND CUSTOM_ANDROID_EXTRA_LIBS lib1.so)
      list(APPEND CUSTOM_ANDROID_EXTRA_LIBS lib2.so)
      
      list(REMOVE_DUPLICATES CUSTOM_ANDROID_EXTRA_LIBS)
      string(REPLACE ";" "," CUSTOM_ANDROID_EXTRA_LIBS_STRING "${CUSTOM_ANDROID_EXTRA_LIBS}")
      set(ANDROID_EXTRA_LIBS "${CUSTOM_ANDROID_EXTRA_LIBS_STRING}" CACHE INTERNAL "")
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            assam Assam Boudjelthia
            rabits Rabit
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes