cmake icon indicating copy to clipboard operation
cmake copied to clipboard

Cannot specify WINAPI version to build against

Open sodevel opened this issue 1 year ago • 6 comments

With b2 i can specify the Windows API version to build against with e.g. define=BOOST_USE_WINAPI_VERSION=0x0601 but unless i miss something this cannot be done for the CMake build.

sodevel avatar May 28 '24 16:05 sodevel

@Lastique what do you think about this? A CMake option in winapi comes to mind.

pdimov avatar May 28 '24 16:05 pdimov

In my libraries, I'm mirroring C++ defines to CMake options, so one would specify e.g. -DBOOST_USE_WINAPI_VERSION=0x0601 in cmake command line and that translates to the equivalent C++ define. I'll add this in Boost.WinAPI's CMakeLists.txt.

Lastique avatar May 28 '24 16:05 Lastique

Done in https://github.com/boostorg/winapi/commit/c5fb9c86e8b9ea460fc6d7255d15d69d4d2705ae.

Lastique avatar May 28 '24 17:05 Lastique

Not sure if this is the right place for this nor am i involved with boost and know their policies, but looking at the cache variables, it looks like they are following the form BOOST_<LIBRARY>_FOO_BAR. Your introduced variable does violate this form, a valid variant would look like BOOST_WINAPI_USE_WINAPI_VERSION.

sodevel avatar May 30 '24 16:05 sodevel

That's OK because it mirrors the macro name.

pdimov avatar May 30 '24 16:05 pdimov

The intention was that BOOST_USE_WINAPI_VERSION would be a Boost-wide macro that affects all libraries using Windows API.

Lastique avatar May 30 '24 21:05 Lastique