Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Warnings in CMake Qt
Qt 6.11 is out! See what's new in the release blog

Warnings in CMake Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AlvaroSA Offline
    AlvaroSA Offline
    AlvaroS
    wrote on last edited by A Former User
    #1

    Hello to all.
    First of all thanks a lot for reading this post and being able to help.

    When I run CMake in Qt it gives me these warnings:

    WARNING: Target "universalTest" requests linking to directory "/home/user/build-proxyMatlab-Desktop_Qt_5_6_0_GCC_64bit-Debug".  Targets may link only to libraries.  CMake is dropping the item.
    
    -------------------------------------------------------------------
    
    CMake Warning (dev) at CMakeLists.txt:23 (LINK_DIRECTORIES):
      This command specifies the relative path
    
        ../universal/lib
    
      as a link directory.
    

    How can I solve them?

    The second warning is because I am trying to link a library as:

    LINK_DIRECTORIES(${PROJECT_SOURCE_DIR} ../universal/lib)
    target_link_libraries (universalTest ${CMAKE_THREAD_LIBS_INIT} ${OpenCV_LIBS} ${CMAKE_BINARY_DIR} libuniversalTestLib)
    
    

    Thanks a lot

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      For the first warning: remove ${CMAKE_BINARY_DIR} from your target_link_libraries call.

      For the second warning: make it an absolute path.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      AlvaroSA 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        For the first warning: remove ${CMAKE_BINARY_DIR} from your target_link_libraries call.

        For the second warning: make it an absolute path.

        AlvaroSA Offline
        AlvaroSA Offline
        AlvaroS
        wrote on last edited by
        #3

        @SGaist Thanks a lot!!! That is the solution!

        I have another question. I ask it here to not create another thread.

        How can I link a shared library? (libuniversalTestLib.so)
        Am I doing right?:

        LINK_DIRECTORIES(${UNIVERSAL_TEST_TOOL_PATH}/lib)
        target_link_libraries (universalTest ${CMAKE_THREAD_LIBS_INIT} ${OpenCV_LIBS} ${UNIVERSAL_TEST_TOOL_PATH}/lib/libuniversalTestLib)
        
        

        It does not give me an error but I do not if I am doing right...

        Thanks a lot.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Remove ${UNIVERSAL_TEST_TOOL_PATH}/lib/lib and keep only universalTestLib

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved