[CMake] Enhancement to CHECK_C_RUNS_SOURCE
Alexander Neundorf
a.neundorf-work at gmx.net
Thu Feb 2 11:59:43 EST 2012
On Wednesday 01 February 2012, Clifford Yapp wrote:
> We currently have a minor local enhancement to CHECK_C_RUNS_SOURCE
> that I would like to contribute back to the main module, if it is
> acceptable to the developers of CMake:
>
> We often have our own .c file stored in our tree for TRY_RUN testing,
> and it is convenient to be able to use CHECK_C_RUNS_SOURCE for testing
> those .c files. At the moment, CHECK_C_RUNS_SOURCE assumes the
> incoming SOURCE variable actually holds the source code - our
> enhancement checks to see if SOURCE holds a valid file path first. If
> it DOES hold a valid file path, TRY_RUN then trys that .c file,
> otherwise the existing CHECK_C_RUNS_SOURCE is preserved. I don't know
> of any sane pathname that would be valid C code or vice versa, so
> there should be no danger of passing in a C source snippit and having
> it mistaken for a file path.
>
> The diff is below - would this be of interest for main-line CMake?
I think so.
In this case, this should also be added to CheckCXXSourceRuns,
CheckCSourceCompiles and CheckCXXSourceCompiles.
Alex
More information about the CMake
mailing list