建置目標 (build_tgt 繼承自 tgt)

建置目標可以是執行檔、共享函式庫、靜態函式庫、共享及靜態函式庫,或共享模組。

由以下擴展

建置目標由以下子類型擴展

由以下回傳

建置目標物件由以下函式及方法回傳

建置目標方法

build_tgt.extract_all_objects()

作用與 extract_objects 相同,但會回傳此目標產生之所有物件檔。

預設情況下,只會回傳為此目標建置的物件,以保持與先前版本的向後相容性。recursive 關鍵字引數的預設值最終會在未來版本中更改為 true

簽名

# Acts the same as `extract_objects`, but returns all object files generated
extracted_obj extract_all_objects(
  recursive : bool  # Also return objects passed to the `objects` argument of this target
)

引數

方法 build_tgt.extract_all_objects() 接受以下關鍵字引數

名稱 類型 描述 標籤
recursive bool

也會回傳傳遞給此目標 objects 引數的物件。

(自 0.46.0 起)

預設 = true


build_tgt.extract_objects()

回傳表示這些來源檔產生的物件檔的不透明值。這通常用於取得單一物件檔並將它們連結到單元測試,或使用自訂標誌編譯某些來源檔。若要在另一個建置目標中使用物件檔,請使用 build_target()declare_dependency()objects: 關鍵字引數,或將它們包含在 custom_target() 的命令列中。

簽名

# Returns an opaque value representing the object files generated for those
extracted_obj extract_objects(
  str | file source...,  # Source filenames for which the built objects should be extracted
)

引數

此方法接受 1無限大 個可變引數 (source...),類型為 str | file

應該擷取其建置物件的來源檔名。


build_tgt.found()

總是回傳 true。此函式旨在使執行檔物件與 external_program 物件的功能相容。這簡化了使用執行檔而非 external_program 的使用案例。

簽名

(自 0.59.0 起)

bool found()


build_tgt.full_path()

回傳指向結果目標檔的完整路徑。注意:在大多數情況下,使用物件本身會執行與此相同的工作,並且還會讓 Meson 正確設定目標之間的相依性。如果這對您不起作用,請提交錯誤報告。

簽名

str full_path()


build_tgt.name()

回傳目標的名稱。

簽名

(自 0.54.0 起)

str name()


build_tgt.path()

執行與 build_tgt.full_path() 完全相同的事情。注意:此函式僅用於與 external_program 物件相容。一旦移除 external_program 物件中也已棄用的對應 path() 函式,此函式就會被移除。

簽名

(自 0.59.0 起)

已棄用

於 0.59.0

str path()


build_tgt.private_dir_include()

回傳一個與 include_directories() 類似的值,但指向此目標的私有目錄。通常只有在另一個目標需要存取此目標的一些已產生的內部標頭時才需要。

簽名

inc private_dir_include()


搜尋結果為