cryptopp-cmake icon indicating copy to clipboard operation
cryptopp-cmake copied to clipboard

Another fix to "winapifamily.h not found problem"

Open LonghronShen opened this issue 7 years ago • 3 comments

The above solution doesn't work for me... But I found another solution: According to the answer here: https://stackoverflow.com/questions/40577415/detect-availablility-of-sdkddkver-h-and-winapifamily-h-from-developer-comman The CMakeList.txt can be modified like this.

LonghronShen avatar Nov 23 '18 15:11 LonghronShen

I don't believe CMake honors things like %PATH% and other variables like %WINDOWSPHONEKITDIR % in a Developer Command Prompt. Or at least my testing did not confirm it.

If the changes are working for you it is probably a side effect of failing to honor them as expected.

noloader avatar Nov 23 '18 17:11 noloader

You're right... The syntax should be changed to $ENV{VAR} to get system environment. Let me have a try.

LonghronShen avatar Nov 23 '18 18:11 LonghronShen

The new fix has been done. It works as expected.

LonghronShen avatar Nov 23 '18 18:11 LonghronShen

Please check the new implementation which should work in all environments:

if(MSVC)
  set(CRYPTOPP_MSVC_COMPILE_OPTIONS)

  # TODO: what about ICC and LLVM on Windows?

  if(CMAKE_SYSTEM_VERSION MATCHES "10\\.0.*")
    # https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
    list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "_WIN32_WINNT=0x0A00")
  endif()
  # winapifamily.h is missing on AppVeyor machines
  include(CheckIncludeFileCXX)
  check_include_file_cxx("winapifamily.h" HAVE_WINAPIFAMILY_H)
  if(HAVE_WINAPIFAMILY_H)
    list(APPEND CRYPTOPP_MSVC_COMPILE_OPTIONS "/FIwinapifamily.h")
  endif()
endif()

abdes avatar Aug 22 '22 18:08 abdes