title: Qt6 desktop app and shared library with cmake
body: <p>I am trying to make a project with subdirectories using cmake.
  When using qmake this mechanism was built in Qt creator.
  The project contains a shared library and a desktop app.
  Below is the structure of the project and cmake I have:</p>
  <p>Main cmake:</p>
  <pre><code>cmake_minimum_required (VERSION 3.5)
  
  project(contractapp)
  
  add_subdirectory(contract-core)
  add_subdirectory(contract-desktop)
  </code></pre>
  <p>Desktop app cmake:</p>
  <pre><code>
  project(contract-desktop LANGUAGES CXX)
  
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
  set(CMAKE_AUTOUIC ON)
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTORCC ON)
  
  set(CMAKE_CXX_STANDARD 17)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
  
  # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
  # Check https://doc.qt.io/qt/deployment-android.html for more information.
  # They need to be set before the find_package( ...) calls below.
  
  #if(ANDROID)
  #    set(ANDROID_PACKAGE_SOURCE_DIR &quot;${CMAKE_CURRENT_SOURCE_DIR}/android&quot;)
  #    if (ANDROID_ABI STREQUAL &quot;armeabi-v7a&quot;)
  #        set(ANDROID_EXTRA_LIBS
  #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
  #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
  #    endif()
  #endif()
  
  find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
  find_package(contract-core REQUIRED)
  
  set(PROJECT_SOURCES
          main.cpp
          MainWindow.cpp
          MainWindow.h
          MainWindow.ui
  )
  
  if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
      qt_add_executable(contract-desktop
          ${PROJECT_SOURCES}
      )
  else()
      if(ANDROID)
          add_library(contract-desktop SHARED
              ${PROJECT_SOURCES}
          )
      else()
          add_executable(contract-desktop
              ${PROJECT_SOURCES}
          )
      endif()
  endif()
  
  target_link_libraries(contract-desktop PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
  </code></pre>
  <p>Shared library cmake:</p>
  <pre><code>cmake_minimum_required(VERSION 3.14)
  
  project(contract-core LANGUAGES CXX)
  
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  set(CMAKE_AUTOUIC ON)
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTORCC ON)
  set(CMAKE_CXX_STANDARD 17)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
  
  find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
  
  add_library(contract-core SHARED
    contract-core_global.h
    Person.cpp
    Person.h
  )
  
  target_link_libraries(contract-core PRIVATE Qt${QT_VERSION_MAJOR}::Core)
  
  target_compile_definitions(contract-core PRIVATE CONTRACTCORE_LIBRARY)
  </code></pre>
  <p>My problem is that the desktop application does not see the library that I am making.</p>