Using FetchContent: Issues with debug postfix
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
When using FetchContent to install Catch2 like this:
```cmake
message(STATUS "Catch2 installation not found. Downloading Catch2 library with FetchContent")
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.0-preview5
)
FetchContent_MakeAvailable(Catch2)
```
there is an issue when building our unit tests:
```sh
gmake[3]: *** No rule to make target '_deps/catch2-build/src/libCatch2d.a', needed by 'fsfw-tests'. Stop.
gmake[3]: *** Waiting for unfinished jobs....
```
Also happens on `v3.0.0-preview4`.
Our unittest is built with DEBUG flags to allow stepping. These flags are of course passed to Catch2, and there appears to be an issue with the according target name.
A solution for this was to add the following lines in our `CMakeLists.txt`
```cmake
# set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
```
**Reproduction steps**
Use FetchContent to fetch Catch2 and build your unit test binary in DEBUG mode
**Platform information:**
- OS: Ubuntu 21.10
- Compiler+version: **GCC v11.2.0**
- Catch version: **v3.0.0-preview4** and **v3.0.0-preview5**
I just wonder if this is
1. A documentation thing by documenting the DEBUG_POSTFIX quickfix when building debug
2. Can be fixed by changing something in the `CMakeLists.txt` of Catch2
3. Can be fixed by changing the way FetchContent is used
Contributor guide
Assessment
This issue has not been assessed yet.