how to build dll by cmake in clion with qt

dear:

we have a project (eg . named Test  ) which include some qt project files . 

and now we want to build project Test to dll for other  project use . 

so we build project Test in clion by cmake .

here is the cmake file content:

cmake_minimum_required(VERSION 3.20)
project(untitled)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(WIN32)
set(CMAKE_PREFIX_PATH "E:/Qt/Qt5.12.6/5.12.6/msvc2017_64")
ENDIF()
set(MYlIB ./library)

add_library(untitled SHARED library/library.cpp)

but in clion . it don't find any qt files , and a lot of error , like can not find include file QString , QVector and so on .

and actually it work fine in

add_executable(untitled SHARED library/library.cpp)

so what should we do if we want to build it successfully . thanks .

 

0
add_executable(untitled  library/library.cpp)
0

请先登录再写评论。