COMPILE_OPTIONS¶
在 3.11 版被加入.
要傳遞給編譯器的額外選項清單。
此屬性包含一個 分號分隔的清單 選項,並在建置此來源檔案時新增到編譯旗標清單中。這些選項將在目標範圍的選項之後新增。
Contents of COMPILE_OPTIONS may use
generator expressions with the
syntax $<...>. However, Xcode does not support per-config
per-source settings, so expressions that depend on the build configuration are
not allowed with that generator.
使用範例:
set_source_files_properties(foo.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
相關屬性:
建議優先使用此屬性而非
COMPILE_FLAGS。使用
COMPILE_DEFINITIONS傳遞額外的預處理器定義。使用
INCLUDE_DIRECTORIES傳遞額外的包含目錄。
相關命令:
add_compile_options()用於目錄範圍的設定target_compile_options()用於目標特定的設定