0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ROS2におけるament_target_dependenciesからtarget_link_librariesへの乗り換え

0
Last updated at Posted at 2026-01-30

ROS2関係トップページへ

概要

Kiled KaijuからCMakeLists.txtの一部使用が変わるらしい.具体的には

  • ament_target_dependenciesがdeprecated(廃止)に.
    • しばらく使えると思うけど.
  • これからはtarget_link_librariesに書いてね.

Jazzy Jaliscoから推奨の書き方になっていたかも.
詳しくはJazzyのここ

乗り換え方

例:

古い書き方
ament_target_dependencies(lambda_subscriber_test
  rclcpp
  std_msgs
)
新しい書き方
target_link_libraries(callback_subscriber_test PUBLIC
  rclcpp::rclcpp
  ${std_msgs_TARGETS}
)

詳細

PUBLICなどの修飾子

以下がある.とりあえずPUBLICにしておくが,詳しくは自分で調査

  • PUBLIC
  • PRIVATE
  • INTERFACE

通常のパッケージ

rclcppなどのライブラリは以下のように読み替え

  • 名前 → 名前::名前
    • もう少し詳しく書くと,パッケージ名/名前空間::ライブラリターゲット名
    • パッケージ名をつけることで以下の情報を持つことができそう?
      • includeディレクトリ
      • 依存ライブラリ
      • コンパイルオプション
    • 各種情報を持つことで,include_directories()などを使わなくてすむようになる?

インターフェースパッケージ

std_msgsなどはインターフェースパッケージ(メッセージ定義)であり,ライブラリと異なる指定方法となる.
以下のように読み替え.

  • 名前 → ${名前_TARGETS}

結構,TARGETSを後ろにつけるのは他でもできるっぽい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?