Skip to content

Let iree_cc_library mirror Bazel cc_library more faithfully. - #4453

Merged
bjacob merged 1 commit into
iree-org:mainfrom
bjacob:fix-cmake-interface-copts
Jan 10, 2021
Merged

bjacob merged 1 commit into
iree-org:mainfrom
bjacob:fix-cmake-interface-copts

Conversation

@bjacob

@bjacob bjacob commented Jan 9, 2021

Copy link
Copy Markdown
Collaborator

In Bazel, in cc_library, copts and linkopts apply only to the library
itself, not its dependents. In a header-only cc_library, copts and linkopts
are ignored.

Note: I checked locally by adding a if() with a message() in this CMake code: there are currently no INTERFACES with COPTS or LINKOPTS.

In Bazel, in cc_library, copts and linkopts apply only to the library
itself, not its dependents. In a header-only cc_library, copts and linkopts
are ignored.
@google-cla google-cla Bot added the cla: yes label Jan 9, 2021
@bjacob
bjacob requested review from ScottTodd and benvanik January 9, 2021 19:36
@bjacob
bjacob merged commit 2072879 into iree-org:main Jan 10, 2021
This was referenced Jan 11, 2021
@GMNGeoffrey

Copy link
Copy Markdown
Member

Hang on, that's not true. linkopts are applied to library and its dependents. We deliberately make use of this with our default_linkopts Bazel rule:

https://github.com/google/iree/blob/a6e2d78338dda3be9455ca39666f3f6a7da6839b/build_tools/BUILD#L23-L37

@bjacob

bjacob commented Jan 12, 2021

Copy link
Copy Markdown
Collaborator Author

Ah, thanks for catching this ! I didn't realize that there was such a dissymetry between copts and linkopts but the bazel documentation says so explicitly - thanks! Going to make a PR to fix that now.

bjacob added a commit to bjacob/iree that referenced this pull request Jan 12, 2021
@bjacob

bjacob commented Jan 12, 2021

Copy link
Copy Markdown
Collaborator Author

PR #4476 is up.

@GMNGeoffrey

Copy link
Copy Markdown
Member

Ah, thanks for catching this ! I didn't realize that there was such a dissymetry between copts and linkopts but the bazel documentation says so explicitly - thanks! Going to make a PR to fix that now.

How foolish of you to expect consistency 😛

bjacob added a commit that referenced this pull request Jan 12, 2021
@rsuderman rsuderman mentioned this pull request Jan 12, 2021
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.

3 participants