-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ergonomics of WIL::WIL
CMake target for consumers using LLVM/MinGW
#467
base: master
Are you sure you want to change the base?
Conversation
- Added definitions for various SAL annotations as macros with empty values in CMakeLists.txt, and set them as `INTERFACE`
WIL::WIL
target for MinGW and ClangWIL::WIL
CMake target for consumers
WIL::WIL
CMake target for consumersWIL::WIL
CMake target for consumers using LLVM/MinGW
While I don't see anything necessarily worrisome here, I also don't have much experience with MinGW (and no experience with MinGW with WIL), so I'm hoping others with more experience can comment here. From past issues/PRs, it seems @m417z or @Berrysoft might be able to provide feedback on this approach. |
I don't personally use CMake, so I don't mind, but I think that while it can be a valid short term approach, the right solution here is to have these definitions included into MinGW (e.g. sal.h). BTW the comment is not precise, as not all the defined macros are SAL annotations. |
That sounds like it's probably the right approach to me. @sharadhr any issues with pursuing the Windows SDK specific changes in MinGW itself? That would just leave |
Perhaps Edit: Alternatively, WIL can be modified to use |
It could maybe be conditionally updated to do so, however WIL cannot in general assume access to the STL |
Good point. I could submit a request/patch to the mailing list. I have already submitted some, and they were merged in not too long after. I could also ask for In all honesty, this entire effort is to get the Azure SDK for C++ compiling on MinGW, and that entire stack exposed just how incomplete MinGW is. For instance, |
Could you provide steps to reproduce any compiler error with mingw-w64 toolchain? It would help to add the required macros in mingw-w64. Please reply to this email https://sourceforge.net/p/mingw-w64/mailman/message/58813213/ |
Relevant to #117 and #454 (the latter of which I feel is incomplete). In that PR users had to
#define
away SAL annotations used by WIL as macros with empty definitions, as well as add-fms-extensions
to their command-line.When consumers (e.g. Azure SDK for C++) use WIL with CMake and compile with Clang targeting MinGW, they will have to re-define these macros for every project that uses WIL, which will be repetitive and unintuitive.
This PR resolves this, at least for CMake.
Now, consumers may simply use
target_link_libraries(my_target PRIVATE WIL::WIL)
and these macros and options will be appended to every command-line invocation when buildingmy_target
, which considerably simplifies matters.The function-like macros are added with
target_compile_options
becausetarget_compile_definitions
does not support function-like macros.