COMPILE_DEFINITIONS

在 4.4 版被加入.

用於編譯來源檔案的預處理器定義。

The COMPILE_DEFINITIONS property may be set to a semicolon-separated list of preprocessor definitions using the syntax VAR or VAR=value. Function-style definitions are not supported. CMake will automatically escape the value correctly for the native build system (note that CMake language syntax may require escapes to specify some values).

CMake 會自動捨棄一些原生建置工具不支援的定義。Xcode 不支援來源檔案上的依組態定義。

免責聲明:大多數原生建置工具對跳脫某些值的支援很差。CMake 對許多情況有因應措施,但某些值可能無法正確傳遞。如果某個值似乎沒有被正確跳脫,請不要嘗試透過在值中新增跳脫序列來解決問題。您的因應措施可能會在未來版本中具有改進跳脫支援的 CMake 中失效。請考慮在(配置過的)標頭檔中定義巨集,然後回報此限制。已知的限制包括:

#

幾乎在所有地方都無法運作。

;

在 VS IDE 7.0 和 Borland Makefiles 中無法運作。

,

在 VS IDE 中無法運作。

%

在某些情況下的 NMake 中無法運作。

& |

在某些情況下的 MinGW 中無法運作。

^ < > \ "

在 Windows 上的大多數 Make 工具中無法運作。

CMake 不會直接拒絕這些值,因為它們在某些情況下確實有效。請謹慎使用。

Contents of COMPILE_DEFINITIONS 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.

相關屬性:

相關命令: