boostorg / boostorg/process

Boost CMake testing procedure doesn't work for Process

Open
#348 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

The [documented testing procedure](https://github.com/boostorg/cmake#testing-boost-with-cmake)

```
mkdir __build && cd __build
cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=process ..
cmake --build . --target tests
ctest --output-on-failure --no-tests=error
```

fails for Boost.Process, because the test executables aren't built by the target `tests`. BoostTest handles this automatically, but for tests declared manually, one needs to first declare the `tests` target if not present

```
if(NOT TARGET tests)
add_custom_target(tests)
endif()
```

and then for each test executable, use `add_dependencies(test my_test_executable)`.

(For this to keep working after the eventual fix, it might be a good idea to add it to CI.)

It's also good practice to make the test executables EXCLUDE_FOR_ALL, so that building the `tests` target builds them, but building the default target doesn't, but this step is not in principle required.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.