Linker.cmake should use target_link_options instead of target_compile_options

オープン
#72 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
cmake
領域
build-system

調査の方向性

cmake/Linker.cmake の 29 行目を開き、現在の target_compile_options 呼び出しを、issue で説明されている target_link_options コマンドと比較します。完了の条件は、リンカー固有のフラグがコンパイル時ではなくリンク時に適用され、影響を受けるセットアップで報告されている未使用引数の警告を回避できることです。

索引モデルが issue の本文から書いたものです。

説明

https://github.com/cpp-best-practices/cmake_template/blob/d19d8921771ba582824948f0cc57f849a5c6efd8/cmake/Linker.cmake#L29

From my understanding target_compile_options can be replaced by the more appropriate target_link_options.

Motivation

Functionally there's no difference, but adding linker-specific flags to the compilation step will raise warnings e.g. clang: error: argument unused during compilation: '-fuse-ld=mold' [-Werror,-Wunused-command-line-argument] in certain setups.

Example from CI in a project of mine. Treating warnings as errors means this harmless warning caused CI to fail.

Using target_link_options resolved it.

Thank you for sharing and maintaining this template project, it is a tremendous help!

主要言語
CMake
スター
1.8k
フォーク
205
PR マージ指標
30日以内にマージされた PR はありません

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cpp-best-practices/cmake_template のほかの issue

cpp-best-practices/cmake_template の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。