2020-01-10 03:41:09 +08:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
|
|
|
|
2020-01-12 02:10:19 +08:00
|
|
|
if(DEFINED PROJECT_NAME)
|
|
|
|
set(SUBPROJECT ON)
|
|
|
|
endif()
|
|
|
|
|
2020-01-10 03:41:09 +08:00
|
|
|
project(qtpromise VERSION 0.5.0 LANGUAGES CXX)
|
|
|
|
|
2020-01-12 02:10:19 +08:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
|
|
|
|
2020-01-10 03:41:09 +08:00
|
|
|
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core)
|
|
|
|
|
2020-01-12 02:10:19 +08:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
2020-01-10 03:41:09 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2020-01-12 02:10:19 +08:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2020-01-10 03:41:09 +08:00
|
|
|
|
|
|
|
add_library(qtpromise INTERFACE)
|
|
|
|
add_library(qtpromise::qtpromise ALIAS qtpromise)
|
|
|
|
|
|
|
|
target_link_libraries(qtpromise INTERFACE Qt5::Core)
|
|
|
|
target_include_directories(qtpromise INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
|
2020-01-12 02:10:19 +08:00
|
|
|
|
|
|
|
add_definitions(
|
|
|
|
-DQT_DEPRECATED_WARNINGS
|
|
|
|
-DQT_NO_KEYWORDS
|
|
|
|
)
|
|
|
|
|
|
|
|
# https://github.com/simonbrunel/qtpromise/issues/10
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
|
|
|
add_compile_options(
|
|
|
|
-Werror
|
|
|
|
-Wpedantic
|
|
|
|
-Wall
|
|
|
|
-Wextra
|
|
|
|
-Wconversion
|
|
|
|
-Wsign-conversion
|
|
|
|
-Wold-style-cast
|
|
|
|
-Wunused-local-typedefs
|
|
|
|
-pedantic-errors
|
|
|
|
)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
|
|
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
|
|
|
|
add_compile_options(
|
|
|
|
/WX
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT SUBPROJECT)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|