I have a CMake project which has an external dependency (Crypto++). The external project has a vcxproj
file provided, so in order to add it to the build process, I added it like this:
ExternalProject_Add(CryptoPP
SOURCE_DIR ${CRYPTOPP_SRC_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND "${MSBUILD_EXE}"
"/p:OutDir=<BINARY_DIR>/bin/$<CONFIG>/"
"/p:IntDir=<BINARY_DIR>/obj/$<CONFIG>/"
"/p:Configuration=$<CONFIG>"
"/p:Platform=${CMAKE_VS_PLATFORM_NAME}"
"<SOURCE_DIR>/${CRYPTOPP_PROJECT}"
INSTALL_COMMAND "${CMAKE_COMMAND}" -E make_directory <INSTALL_DIR>/lib
COMMAND "${CMAKE_COMMAND}" -E copy <BINARY_DIR>/bin/$<CONFIG>/cryptlib${CMAKE_STATIC_LIBRARY_SUFFIX} <INSTALL_DIR>/lib
)
This worked fine until I started using Windows 10. Now I'm getting this error: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution"
.
I tried passing the SDK version from CMake, using the only related CMake variable I could find, by adding this flag to msbuild:
"/p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}"
However, I'm still getting the same error. I tried displaying the value of the CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
variable, and it always seems empty.
Modifying the dependency vcxproj
is not an option. I don't know in advance what SDK version whoever needs to build the project has installed, so that's not an option.
I can't find any way to obtain and pass the SDK version to the external project build, what am I doing wrong?