google / google/or-tools

cmake/cpp.cmake exports -fwrapv and warning suppression flags as PUBLIC

Open
#5,095 2 comments 0 reactions 1 assignee Claimed by @Mizux View on GitHub
Bug Build: CMake Feature Request OS: Linux
Dominant language
C++
Stars
14.1k
Forks
2.5k
Avg merge
8h 39m
Merged PRs (30d)
72

Description

**What version of OR-Tools and what language are you using?**
Version: main
Language: C++ CMake build
Platform: Linux

**Description**

OR-Tools' CMake build exports three compiler options: `-fwrapv, -Wno-range-loop-construct, -Wno-sign-compare` as `PUBLIC` on the ortools target. This means every downstream target that links ortools::ortools silently inherits these flags. All three should be PRIVATE to the OR-Tools build, not imposed on consumers.

[Relevant line in cpp.cmake ](https://github.com/google/or-tools/blob/main/cmake/cpp.cmake#L137). `-fwrapv` seems like it's been imposed for many years, however, the list was recently extended in #4951.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.