Skip to content

Commit

Permalink
Add comments, fix usage of WDKContentRoot for WDK 8/8.1 (SergiusTheBe…
Browse files Browse the repository at this point in the history
  • Loading branch information
SergiusTheBest committed Oct 3, 2022
1 parent 3dcb6ef commit f327352
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cmake/FindWdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,22 @@
# target_link_libraries(KmdfCppDriver KmdfCppLib)
#

cmake_minimum_required(VERSION 3.18)

if(DEFINED ENV{WDKContentRoot})
file(GLOB WDK_NTDDK_FILES
"$ENV{WDKContentRoot}/Include/*/km/ntddk.h"
"$ENV{WDKContentRoot}/Include/*/km/ntddk.h" # WDK 10
"$ENV{WDKContentRoot}/Include/km/ntddk.h" # WDK 8.0, 8.1
)
else()
file(GLOB WDK_NTDDK_FILES
"C:/Program Files*/Windows Kits/*/Include/*/km/ntddk.h"
"C:/Program Files*/Windows Kits/*/Include/km/ntddk.h"
"C:/Program Files*/Windows Kits/*/Include/*/km/ntddk.h" # WDK 10
"C:/Program Files*/Windows Kits/*/Include/km/ntddk.h" # WDK 8.0, 8.1
)
endif()

if(WDK_NTDDK_FILES)
list(SORT WDK_NTDDK_FILES COMPARE NATURAL) # sort to use the latest available WDK
list(GET WDK_NTDDK_FILES -1 WDK_LATEST_NTDDK_FILE)
endif()

Expand All @@ -60,11 +64,11 @@ get_filename_component(WDK_ROOT ${WDK_LATEST_NTDDK_FILE} DIRECTORY)
get_filename_component(WDK_ROOT ${WDK_ROOT} DIRECTORY)
get_filename_component(WDK_VERSION ${WDK_ROOT} NAME)
get_filename_component(WDK_ROOT ${WDK_ROOT} DIRECTORY)
if (NOT WDK_ROOT MATCHES ".*/[0-9][0-9.]*$")
get_filename_component(WDK_ROOT ${WDK_ROOT} DIRECTORY)
if (NOT WDK_ROOT MATCHES ".*/[0-9][0-9.]*$") # WDK 10 has a deeper nesting level
get_filename_component(WDK_ROOT ${WDK_ROOT} DIRECTORY) # go up once more
set(WDK_LIB_VERSION "${WDK_VERSION}")
set(WDK_INC_VERSION "${WDK_VERSION}")
else()
else() # WDK 8.0, 8.1
set(WDK_INC_VERSION "")
foreach(VERSION winv6.3 win8 win7)
if (EXISTS "${WDK_ROOT}/Lib/${VERSION}/")
Expand Down

0 comments on commit f327352

Please sign in to comment.