-
Notifications
You must be signed in to change notification settings - Fork 59
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
add macro to assist in checking if code snippets compile #600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @white238 - I tried out the branch locally with my Umpire tests and all seems good.
This fixes spack/spack#32932 for me |
4a37030
to
02a36a2
Compare
02a36a2
to
7901598
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @white238 !
tests/internal/unit/CMakeLists.txt
Outdated
"#include <iostream> | ||
|
||
int main(int, char**) | ||
{ | ||
|
||
std::cout << \"Hello World!\" << std::endl; | ||
|
||
return 0; | ||
} | ||
") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Should we use a "bracket argument" (multiline string) instead of a single quote string?
One benefit would be that we wouldn't need to modify the quotation marks
e,g,:
[=[
#include <iostream>
int main(int, char**)
{
std::cout << \"Hello World!\" << std::endl;
return 0;
}
]=]
See: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked.. added it as a code snippet in the documentation as well.
|
||
set(options) | ||
set(singleValueArgs CODE_COMPILES VERBOSE_OUTPUT) | ||
set(multiValueArgs SOURCE_STRING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SOURCE_STRING
need to be a multiValueArg
because it can have embedded semicolons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i bet it shouldn't actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried changing this to a single value arg and it removed all the semi-colons.
We ran into a problem where Umpire was trying to use CMake's macro
check_cxx_source_compiles
. We found that it did not honor theCMAKE_CXX_STANDARD
. There is a policy to control this but I could only get it to work for CMake 3.14.5 and 3.18.0 but anything above that did not work.This adds a macro we have used in Axom for a while. It is much more reliable and also allows you to output verbosely to the screen. For example: