# CheckCXXSourceRuns bug?

**URL:** https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188
**Category:** Development
**Created:** [June 21, 2019, 5:51am UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188 "2019-06-21T05:51:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [June 21, 2019, 5:51am UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188/1 "2019-06-21T05:51:00Z")

</div>

Folks,

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 21, 2019, 6:59pm UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188/2 "2019-06-21T18:59:07Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [June 21, 2019, 7:33pm UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188/3 "2019-06-21T19:33:09Z")

</div>

Some compilers will link but always return true on matches.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [June 21, 2019, 8:00pm UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188/4 "2019-06-21T20:00:31Z")

</div>

Ben,

The use of kwsys regular expression vs. std::regex was discussed in this [issue](https://gitlab.kitware.com/cmake/cmake/issues/17686) was a year ago.

And [this part of the discussion](https://gitlab.kitware.com/cmake/cmake/issues/17686#note_369516) talks about the skeleton code in some compilers that compiles but does not run correctly.

Bill

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 25, 2019, 1:24pm UTC](https://discourse.vtk.org/t/checkcxxsourceruns-bug/1188/5 "2019-06-25T13:24:44Z")

</div>

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