title: Linking with a custom external library in CMAKE
body: <p>There is a project, when building the project has problem with a linking library to the project.
  I would be very grateful if someone told me how to solve this problem.
  As I understand the problem is in the correct location of the library. So that when build the project correctly linked with it.</p>
  
  <p>This is projects file CmakeList</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5.1)
  project(maintenance)
  
  set(CMAKE_CXX_STANDARD 11)
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTORCC ON)
  set(CMAKE_AUTOUIC OFF)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  #set(CMAKE_VERBOSE_MAKEFILE ON)
  
  find_package(Qt5Widgets REQUIRED)
  find_package(Qt5Core REQUIRED)
  find_package(Qt5Gui REQUIRED)
  find_package(Qt5Charts REQUIRED)
  find_package(Qt5Xml REQUIRED)
  find_package(Qt5Network REQUIRED)
  
  include_directories(../../088)
  
  #include(FindPackageHandleStandardArgs)
  #find_library(Network_LIBRARY NAMES NetworkCommunication PATHS ../../088/build-libs-ubuntu-Release)
  #find_package_handle_standard_args(Network DEFAULT_MSG Network_LIBRARY)
  
  add_library(NetworkCommunication SHARED IMPORTED)
  set_property(TARGET NetworkCommunication PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../../088/build-libs-ubuntu-Release/libNetworkCommunication.so)
  set(Network_LIBRARY NetworkCommunication)
  
  #link_directories(${CMAKE_CURRENT_LIST_DIR}/../../088/build-libs-ubuntu-Release)
  
  qt5_add_resources(RCC_RESOURCES resources.qrc)
  
  file(GLOB SOURCE_FILES_2
          ${CMAKE_CURRENT_SOURCE_DIR}/cop/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/cop/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/curves/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/curves/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/curves/shapes/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/curves/shapes/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/general/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/general/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/load_cells/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/load_cells/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/motors/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/motors/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/passive_mode/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/passive_mode/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/settings/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/settings/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/system/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/system/*.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/../Gener095/Messages/*.h
          ${CMAKE_CURRENT_SOURCE_DIR}/../Gener095/Messages/*.cpp
          )
  
  set(SOURCE_FILES
          Error.cpp
          Error.hpp
          main.cpp
          MainWindow.cpp
          MainWindow.h
          NetworkCommunicator.cpp
          NetworkCommunicator.h
          Utils.cpp
          Utils.h
          ITab.h
          )
  
  add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${SOURCE_FILES_2} ${RCC_RESOURCES})
  
  #target_link_libraries(${PROJECT_NAME} ${Network_LIBRARY})
  target_link_libraries(${PROJECT_NAME} NetworkCommunication)
  target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Charts Qt5::Xml Qt5::Network)
  
  include(../../088/BuildUtilities/scripts/lib_setup.cmake)
  </code></pre>
  
  <p>and logs with errors</p>
  
  <pre><code>...
  [ 95%] Building CXX object CMakeFiles/maintenance.dir/qrc_resources.cpp.o
  [ 97%] Building CXX object CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o
  [100%] Linking CXX executable maintenance
  CMakeFiles/maintenance.dir/MainWindow.cpp.o: In function `MainWindow::MainWindow(QMainWindow*)':
  /media/blinct/free1/QtProjects/Applications/095/maintenance/MainWindow.cpp:74: undefined reference to `TenzGraphTab::TenzGraphTab(QWidget*)'
  CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o: In function `AngleSensors::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)':
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:92: undefined reference to `AngleSensors::OnSetNullPosition()'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:93: undefined reference to `AngleSensors::OnResetAccel()'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:94: undefined reference to `AngleSensors::OnDataReceived(QString, QMap&lt;QString, QVariant&gt;)'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:95: undefined reference to `AngleSensors::OnHandleUp()'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:96: undefined reference to `AngleSensors::OnHandleDown()'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:97: undefined reference to `AngleSensors::OnHandleReleased()'
  /media/blinct/free1/QtProjects/Applications/095/maintenance/cmake-build-debug/maintenance_autogen/ECUKZBRF6L/moc_AngleSensors.cpp:98: undefined reference to `AngleSensors::OnHandleTimer()'
  CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o:(.data.rel.ro._ZTV17AngleSensorColumn[_ZTV17AngleSensorColumn]+0x28): undefined reference to `AngleSensorColumn::~AngleSensorColumn()'
  CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o:(.data.rel.ro._ZTV17AngleSensorColumn[_ZTV17AngleSensorColumn]+0x30): undefined reference to `AngleSensorColumn::~AngleSensorColumn()'
  CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o:(.data.rel.ro._ZTV17AngleSensorColumn[_ZTV17AngleSensorColumn]+0x1c0): undefined reference to `non-virtual thunk to AngleSensorColumn::~AngleSensorColumn()'
  CMakeFiles/maintenance.dir/maintenance_autogen/moc_compilation.cpp.o:(.data.rel.ro._ZTV17AngleSensorColumn[_ZTV17AngleSensorColumn]+0x1c8): undefined reference to `non-virtual thunk to AngleSensorColumn::~AngleSensorColumn()'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlSerialPortImpl::setRequestToSend(bool)'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `g_sVersion_NetworkCommunication'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlUdpSocketImpl::writeDatagram(QByteArray const&amp;, QHostAddress const&amp;, unsigned short)'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlTcpServerImpl::isListening() const'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlFileImpl::close()'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlTcpServerImpl::hasPendingConnections() const'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlTcpSocketImpl::connectToHost(QHostAddress const&amp;, unsigned short)'
  ...
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlUdpSocketImpl::readDatagram(char*, long long, QHostAddress*, unsigned short*)'
  ../../../088/build-libs-ubuntu-Release/libNetworkCommunication.so: undefined reference to `BtlTcpServerImpl::close()'
  collect2: error: ld returned 1 exit status
  CMakeFiles/maintenance.dir/build.make:936: recipe for target 'maintenance' failed
  make[3]: *** [maintenance] Error 1
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/maintenance.dir/all' failed
  make[2]: *** [CMakeFiles/maintenance.dir/all] Error 2
  CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/maintenance.dir/rule' failed
  make[1]: *** [CMakeFiles/maintenance.dir/rule] Error 2
  Makefile:118: recipe for target 'maintenance' failed
  make: *** [maintenance] Error 2
  </code></pre>
  
  <p>Thanks in advance.
  For a very long time I can not understand how to solve this problem.</p>