ScreenLockDetector/CMakeLists.txt

72 lines
1.4 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(ScreenLockDemo VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Auto-include current directory for MOC
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Enable Qt MOC, UIC, RCC
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Set Qt5 path
set(Qt5_DIR "$ENV{HOME}/sdk/qt-5.15.2/lib/cmake/Qt5")
# Find Qt5 packages
find_package(Qt5 REQUIRED COMPONENTS
Core
Gui
Widgets
DBus
)
# Source files
set(SOURCES
src/main.cpp
src/mainwindow.cpp
src/screenlockdetector.cpp
src/customwidget.cpp
)
# Header files
set(HEADERS
src/mainwindow.h
src/screenlockdetector.h
src/customwidget.h
)
# Add executable
add_executable(${PROJECT_NAME}
${SOURCES}
${HEADERS}
)
# Link Qt5 libraries
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::DBus
)
# Set output directory
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
# Install target
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
# Print configuration info
message(STATUS "========================================")
message(STATUS "Build Configuration:")
message(STATUS "========================================")
message(STATUS "Qt5_DIR: ${Qt5_DIR}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "========================================")