-
Notifications
You must be signed in to change notification settings - Fork 65
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
No _FOUND variable is set #16
Comments
Can you describe a case, where you need this variables? |
The point is to be able to pull this module as a whole optionally (e.g. a user may or may not pull it when I set it as a submodule of my own git repo).
because I found that just loading the module defines |
This is a good point. |
Also, if you don't set |
Working on a quickfix in #18. |
I took a look at #18 and found a little problem: when should Do you agree in setting |
@alehaa I would agree with that. |
@TheAssassin I'll comment here to get the discussion coherent.
I don't think this is useful, as the sanitizers are independent. Therefore setting the variable as always true like done in your patch, seems useful for me. However, |
Looking into how to "detect" sanitizer support at the moment. There's
I have changed my mind since I looked into how FindPackageHandleStandardArgs works. It supports a component-based interface, so if the module supports it, you could check for the support of specific sanitizers using e.g., As described in #18 (comment), it is possible to check whether this module is available at all by checking |
Updated the PR to introduce FindPackageHandleStandardArgs, you're welcome to leave your comments there, everyone. |
I've been thinking a bit about this issue. After all, I don‘t think there is any sense in include FPHSA et all. FPHSA is used to tell, if a specific library or tool is available or not. One could say this module works the same. However, this module is not used to tell, if compiler XY supports AddressSanitizer or not, but conditionally enable compiler flags if they‘re supported. And there‘s no reliable way to tell, if this module „found“ the sanitizers. Let me give you a small example: I reworked this module for use in PnMPI. This project includes a library composed out of C and Fortran files. However, clang and GNU sanitizers aren‘t compatible in the same object. How should we anser if sanitizers work for this target, if we don‘t know anything about the targets this module is being used on? That can be done in A second disadvantage is, that the the compiler feature doesn‘t tell anything about the feature actually being used. That depends on the And what about projects using multiple languages and one of the compilers doesn‘t have sanitizer support? did we find sanitizers then, or didn’t we? I agree with @henryiii, that this module possibly shouldn‘t be a find module. CMake itself supports conditional compiler features, but as far as I know, these are not extensible with additional features. After all, I think FPHSA shouldn‘t be used in the described way. For |
+1 on this. I ran into the same problem: we need a clean way to determinate if Sanitizer package was found or not. The way to go is to define Sanitizers_FOUND. |
Chiming in to say "me too"... My use case was that sanitizers-cmake will be distributed as an optional CMake-only tools package with helpful CMake extensions. Users might have or not this package, so any other project should use the provided tools exclusively in a conditional way. So in other words, it should be possible to do this:
Also I fell victim to a partial lie from the official CMake documentation on find_package, which states that...
And well, I'm saying it is a "lie" because it seems to imply that CMake itself will set that variable but seems that's not the case, given the existence of this bug report... even that technically the Sanitizers CMake module was correctly found and loaded. |
And that makes it difficult to make sanitizers support optional.
The text was updated successfully, but these errors were encountered: