add macro to assist in checking if code snippets compile#600
add macro to assist in checking if code snippets compile#600
Conversation
This fixes spack/spack#32932 for me |
4a37030 to
02a36a2
Compare
02a36a2 to
7901598
Compare
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.
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;
}
]=]There was a problem hiding this comment.
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.
Does SOURCE_STRING need to be a multiValueArg because it can have embedded semicolons?
There was a problem hiding this comment.
i bet it shouldn't actually.
There was a problem hiding this comment.
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: