CheckCXXSourceRuns bug?


I’m trying to use VTK/CMake/CheckCXXSourceRuns.cmake.
My CXX file runs and checks to see if a certain capability works correctly.

  1. The VTK version of the cmake macro reports success if the program compiles, not if it runs successfully. This seems to be a bug.

  2. The CMake version CMake/Modules/CheckCXXSourceRuns.cmake does the proper checking. Why does the VTK version have the same name as the CMake version?

VTK’s copy should probably just go away. It hasn’t been meaningfully edited in over 5 years. If this is for <regex> detection, is a simple try_compile not sufficient? Why would we need to run the resulting code since it’s a linker error?

Some compilers will link but always return true on matches.


The use of kwsys regular expression vs. std::regex was discussed in this issue was a year ago.

And this part of the discussion talks about the skeleton code in some compilers that compiles but does not run correctly.


Well, that is…dumb. Also, probably explicitly against the standard.