Skip to content

Conversation

@milan-panta
Copy link
Contributor

Summary

  • Remove redundant target_compile_options(... ${OpenMP_C_FLAGS}) from the non-Homebrew OpenMP path, where OpenMP::OpenMP_C already propagates compile flags via INTERFACE properties
  • Move target_compile_options inside the HOMEBREW_OPENMP branch for test and diff tool targets, where it's actually needed

Problem: On CMake 4.x+, find_package(OpenMP) now succeeds natively on macOS with Apple Clang + Homebrew libomp, bypassing the manual Homebrew fallback. In the standard path, ${OpenMP_C_FLAGS} expands to the string "-Xclang -fopenmp" which target_compile_options passes as a single quoted argument — causing clang: error: unknown argument: '-Xclang -fopenmp'. This was also redundant since OpenMP::OpenMP_C already adds the same flags correctly.

Affected targets: vscode_diff, test executables, diff CLI tool.

No impact on Linux/Windows — OpenMP::OpenMP_C has carried compile flags via INTERFACE properties since CMake 3.9 (project requires 3.15+). No impact on the Homebrew fallback path, which is unchanged.

On newer CMake (4.x+), find_package(OpenMP) succeeds on macOS,
bypassing the Homebrew fallback. In the standard path,
target_compile_options added ${OpenMP_C_FLAGS} as a single quoted
argument ("-Xclang -fopenmp"), which clang rejects. This was
redundant since OpenMP::OpenMP_C already propagates compile flags
via INTERFACE properties.

Move target_compile_options into the HOMEBREW_OPENMP branch where
it's actually needed, and remove it from the standard path.
@milan-panta
Copy link
Contributor Author

Superseded by #234 (same changes, cleaned up branch name).

@milan-panta milan-panta closed this Feb 8, 2026
@milan-panta milan-panta deleted the 02-08-fix_cmake_remove_redundant_openmp_compile_flags_in_non-homebrew_path branch February 8, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant