-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
34 lines (23 loc) · 1.1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
cmake_minimum_required(VERSION 3.5)
project(PopupMessageBox LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(${PROJECT_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(${PROJECT_NAME}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
file(GLOB_RECURSE ${PROJECT_NAME}_HDR_FILES ${${PROJECT_NAME}_INCLUDE_DIR}/*.h ${${PROJECT_NAME}_INCLUDE_DIR}/*.hpp)
file(GLOB_RECURSE ${PROJECT_NAME}_SRC_FILES ${${PROJECT_NAME}_SOURCE_DIR}/*.cpp)
add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_HDR_FILES} ${${PROJECT_NAME}_SRC_FILES})
add_library(PopMsgBox ALIAS ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
target_include_directories(${PROJECT_NAME} PUBLIC ${${PROJECT_NAME}_INCLUDE_DIR})
option(BUILD_EXAMPLE "Build with example" ON)
if(BUILD_EXAMPLE)
add_subdirectory(example)
message("Build with example")
endif()