`blt::openmp` INTERFACE_COMPILE_OPTIONS may not delimit lists correctly.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 296
- Forks
- 66
- Avg merge
- 1h 3m
- Merged PRs (30d)
- 1
Description
`blt_add_target_compile_flags()` does not prefix `SHELL:` the way `blt_add_target_link_flags()` does. This means that BLTSetupOpenMP.cmake gets multiple arguments in the `${OpenMP_CXX_FLAGS}` string, we get a single list element containing a space instead of a semicolon delimited list of arguments.
The OpenMP::OpenMP_CXX target deals with this by prefixing `SHELL:`, so that seems like a reasonable approach.
For a failure case, consider that the Apple Clang compilers with `libomp` from Homebrew require '-Xclang -fopenmp'. Configure the following CMake project with `-DOpenMP_ROOT=/opt/homebrew/opt/libomp`.
```
cmake_minimum_required(VERSION 3.15)
project(testbltopenmp)
set(ENABLE_OPENMP TRUE)
include(blt/SetupBLT.cmake)
blt_print_target_properties(TARGET blt::openmp)
blt_print_target_properties(TARGET OpenMP::OpenMP_CXX)
```
Result:
```
...
Problems were encountered while collecting compiler information:
clang++: error: unknown argument: '-Xclang -fopenmp'
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in blt_add_target_compile_flags() and BLTSetupOpenMP.cmake, then reproduce the issue with the CMake project and OpenMP_ROOT=/opt/homebrew/opt/libomp shown in the report. Compare blt::openmp with OpenMP::OpenMP_CXX and verify that the compiler receives -Xclang and -fopenmp as separate arguments without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100