# Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) #set(CMAKE_AUTOUIC ON) #set(CMAKE_AUTORCC ON) add_library(SingleApplication singleapplication.cpp singleapplication.h singleapplication_p.h) target_link_libraries(SingleApplication Qt5::Core Qt5::Network Qt5::Widgets ) target_compile_definitions(SingleApplication PRIVATE QAPPLICATION_CLASS=QApplication ) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") target_link_libraries(SingleApplication Advapi32 ) endif()