cmake_minimum_required(VERSION 3.14) project(proj LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) find_package(Qt6 COMPONENTS Core) add_library(TARGET_A SHARED main.cpp) target_link_libraries(TARGET_A PUBLIC Qt::Core) qt6_add_executable(TARGET_B main.cpp) target_link_libraries(TARGET_B PUBLIC Qt::Core)