[CMake] [cmake-developers] Multi-line strings with indentation ignored
Brad King
brad.king at kitware.com
Fri Jan 20 09:12:10 EST 2017
On 01/18/2017 10:52 AM, Robert Dailey wrote:
> At the moment, with CMake 3.0 and on, I can use this syntax for
> multi-line strings:
>
> option( ZIOSK_ENABLE_ZPAY_DIAGNOSTICS "\
> Enable additional diagnostic logs for zPay related code. \
> Should not be enabled for production due to the sensitivity \
> and volume of logs that will be printed." )
One can also use bracket arguments:
https://cmake.org/cmake/help/v3.7/manual/cmake-language.7.html#bracket-argument
but they (intentionally) don't process any variable references.
Also they don't ignore indentation.
> "Enable additional diagnostic logs for zPay related code. "
> "Should not be enabled for production due to the sensitivity "
> "and volume of logs that will be printed" )
>
> it sees each string as a separate parameter.
Correct.
> Is there a mechanism I can use to style my strings this way?
One can do it with an intermediate variable:
```
string(CONCAT mystringvar
"Enable additional diagnostic logs for zPay related code. "
"Should not be enabled for production due to the sensitivity "
"and volume of logs that will be printed"
)
option(ZIOSK_ENABLE_ZPAY_DIAGNOSTICS "${mystringvar}")
```
> are there any plans to add better multi-line string support?
Not currently.
-Brad
More information about the CMake
mailing list