COMPILE_OPTIONS¶
在 4.4 版被加入.
要傳遞給編譯器的額外選項清單。
This property holds a semicolon-separated list of options and will be added to the list of compile flags when the sources of this file set are built. The options will be added after target-wide options and source level ones.
COMPILE_OPTIONS 的內容可以使用語法 $<...> 的「生成器表達式」。請參閱 cmake-generator-expressions(7) 手冊以了解可用的表達式。但是,Xcode 不支援依組態和依來源的設定,因此不允許在該生成器中使用依賴於建置組態的表達式。
Usage example:
set_property(FILE_SET SOURCES TARGET foo PROPERTY
COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
相關屬性:
Use
COMPILE_DEFINITIONSto pass additional preprocessor definitions.Use
INCLUDE_DIRECTORIESto pass additional include directories.
相關命令:
add_compile_options()用於目錄範圍的設定target_compile_options()用於目標特定的設定set_source_files_properties()for source-specific settings