Warnings in CMake Qt



  • 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


  • Lifetime Qt Champion

    Hi,

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

    For the second warning: make it an absolute path.



  • @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.


  • Lifetime Qt Champion

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.