Skip to content

Commit

Permalink
[CMAKE] Fix to Api validator for older cmake versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Jan 7, 2025
1 parent 26e5fe9 commit 120ccae
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions cmake/developer_package/api_validator/api_validator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ can't find Windows SDK version. Try to use vcvarsall.bat script")
endif()
endif()

# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows we don't have such variable
set(PROGRAMFILES_ENV "ProgramFiles\(X86\)")

# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows
# we don't have such variable
if(DEFINED ENV{${PROGRAMFILES_ENV}})
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)

set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
endif()

# check UniversalCRTSdkDir env variable
if(DEFINED ENV{WindowsSdkBinPath})
file(TO_CMAKE_PATH $ENV{WindowsSdkBinPath} UNIVERSAL_SDK_BIN_PATH)

list(APPEND WDK_PATHS "${UNIVERSAL_SDK_BIN_PATH}/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${UNIVERSAL_SDK_BIN_PATH}/x64")
endif()

if(WDK_PATHS)
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
Expand Down Expand Up @@ -90,7 +98,10 @@ endfunction()

set(VALIDATED_TARGETS "" CACHE INTERNAL "")

function(_ov_add_api_validator_post_build_step)
#
# ov_add_api_validator_post_build_step(TARGET <name>)
#
function(ov_add_api_validator_post_build_step)
if((NOT ONECORE_API_VALIDATOR) OR (WINDOWS_STORE OR WINDOWS_PHONE))
return()
endif()
Expand Down Expand Up @@ -212,10 +223,3 @@ function(_ov_add_api_validator_post_build_step)
list(APPEND VALIDATED_TARGETS ${API_VALIDATOR_TARGETS})
set(VALIDATED_TARGETS "${VALIDATED_TARGETS}" CACHE INTERNAL "" FORCE)
endfunction()

#
# ov_add_api_validator_post_build_step(TARGET <name>)
#
function(ov_add_api_validator_post_build_step)
_ov_add_api_validator_post_build_step(${ARGN})
endfunction()

0 comments on commit 120ccae

Please sign in to comment.