diff --git a/CMakeLists.txt b/CMakeLists.txt index f3cc17a47b57721c5d34aab4e2c351e3ef961de6..83fff5efcb0b4abd93f816311b88da3df61606ac 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,17 @@ else() message(STATUS "Found QtDir=" ${Qt5_DIR}) endif() +if (WIN32) +# 设置WinKit配置参数 +if(NOT DEFINED ENV{WinKit_LIB64}) + # 请配置 WinKit_LIB64 环境变量,如:WinKit_LIB64=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64 + message(FATAL_ERROR "Can not find environment variable: WinKit_LIB64") +else() + set(WinKit_LIB64 $ENV{WinKit_LIB64}) + message(STATUS "Found WinKit_LIB64=" ${WinKit_LIB64}) +endif() +endif() + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) @@ -225,7 +236,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow -Wstrict-aliasing -Wstack-protector -Wextra -Wall") - + if(WIN32) + link_directories(${WinKit_LIB64}) + endif elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")