llnl / llnl/blt

`blt::openmp` INTERFACE_COMPILE_OPTIONS may not delimit lists correctly.

Open
#723 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.