← All tasks
cppgoogle/benchmark #2078Not a task: not reproduced

[BUG] Unneccesary re-run of cxx_feature_check on cmake config re-run

envgap__google__benchmark-2078

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
2279f2acc8f2ca1bb51195a12966411bed31b26b
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

google/benchmark #2078 · read the original issue
It is not necessary to run `cxx_feature_check` for `HAVE_GNU_POSIX_REGEX`, `HAVE_POSIX_REGEX`, `HAVE_STEADY_CLOCK` or `HAVE_PTHREAD_AFFINITY` on every cmake re-config.

E.g. log on cmake config:

```
-- Google Benchmark version: v1.9.4, normalized to 1.9.4
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile
```
No compiler tests should be performed on a re-config as it is tied to the C/CXX compiler.

The issue is because of the following code:
```
cxx_feature_check(STD_REGEX)
cxx_feature_check(GNU_POSIX_REGEX)
cxx_feature_check(POSIX_REGEX)
if(NOT HAVE_STD_REGEX AND NOT HAVE_GNU_POSIX_REGEX AND NOT HAVE_POSIX_REGEX)
  message(FATAL_ERROR "Failed to determine the source files for the regular expression backend")
endif()
```

This is not necessary. A suggestion to solve this is to change `cxx_feature_check` such that it sets the necessary feature variables in the cache instead of a normal variable. On config re-run, CMake will see that the variable is already set and not run the tests again.

To reproduce, run this twice and inspect the log:
```
cmake -B build -G Ninja -DBENCHMARK_DOWNLOAD_DEPENDENCIES=1
```

Expected behaviour: the second call to cmake should be a no-op and run no compiler tests, and print nothing to the console.
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]