Merge bitcoin/bitcoin#31015: build: have "make test" depend on "make all"

2957ca9611 build: have "make test" depend on "make all" (Cory Fields)

Pull request description:

  See [Upstream docs](https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_TEST_ALL_DEPENDENCY.html) for specifics.

  Unfortunately, this **seems to have no effect when directly executing `ctest`** :(

  This brings the test -> hack -> test cycle more inline with how it worked with autotools.

  With `CMAKE_SKIP_TEST_ALL_DEPENDENCY` set to FALSE, `make test` will trigger a rebuild, ensuring that test binaries are current before running them.

  To test:
  ```
  cmake -S . -B build
  make -C build -j24
  touch src/primitives/transaction.cpp
  make -C build test ARGS=-j24
  ```

  Without this commit, the above will not rebuild before running tests.

ACKs for top commit:
  tdb3:
    ACK 2957ca9611
  itornaza:
    ACK 2957ca9611
  laanwj:
    ACK 2957ca9611

Tree-SHA512: 46e6d53fd9c28b2f47b34c42ae0b061b01ef7614cdf5ee7d49fb9d3413ca92983d8a996379a9067ac8a8cfc16b230946401e68cf114bd4e3c5c02db2c55ec6bb
pull/31198/head
Ava Chow 1 week ago
commit 6251610553
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41

@ -542,6 +542,12 @@ endif()
if(BUILD_TESTS)
enable_testing()
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
# have "make test" depend on "make all"
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE)
endif()
# TODO: The `CMAKE_SKIP_BUILD_RPATH` variable setting can be deleted
# in the future after reordering Guix script commands to
# perform binary checks after the installation step.

Loading…
Cancel
Save