openal-soft
openal-soft copied to clipboard
Compiling on Windows 8.1 leads to conflict with /permissive- flag due to selected SDK
Hi,
I was attempting to install sfml via vcpkg, which drew in openal-soft 1.21.1 as a dependency. Compilation failed because CMake was unable to find the Windows 8.1 SDK (I am running 8.1). I duly added it to my Visual Studio components, but then a further error occurred. A number of .cpp files failed to build due to a syntax error in combaseapi.h within the Windows 8.1 SDK. Following some searching, it became clear that the compiler flag /permissive- is incompatible with the Windows 8.1 SDK, and Microsoft have no plans to back-port changes to that SDK.
However, by default Visual Studio uses the Windows 10 SDK for Windows 8.1 targets. I downloaded the 1.21.1 release files, generated a VS2019 solution using CMake (which selected the Windows 8.1 SDK during configuration), then manually changed each project within the solution to use the Windows 10 SDK. I was then able to compile the library.
My question is whether it is necessary for the Windows 8.1 SDK to be selected when building for 8.1, when it's my (perhaps incorrect) understanding that the Windows 10 SDK is a more appropriate choice when using the /permissive- flag. If not, would it be possible for the build to be adjusted to use the Windows 10 SDK when building for Windows 8.1? Unfortunately my CMake skills currently extend as far as using CMake GUI to change a few options, so I'm not able to make a pull request.
Thanks!
Sorry for the late response.
Currently the CMake scripts don't handle the Windows SDK explicitly. Whatever CMake decides to set up for MSVC targets is the default CMake behavior for MSVC. 1.21.0 used to explicitly look for and use the Windows SDK, but as that was creating its own issues with some MSVC environments, that was removed for 1.21.1 and it uses the defaults that CMake sets up. IIRC, CMake has option for controlling the SDK used, though I'm not familiar with what they are.