[Cmake-commits] [cmake-commits] hoffman committed syntax.html 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 10 20:54:18 EDT 2008


Update of /cvsroot/CMake/CMakeWeb/HTML
In directory public:/mounts/ram/cvs-serv3842

Modified Files:
	syntax.html 
Log Message:
ENH: more syntax stuff


Index: syntax.html
===================================================================
RCS file: /cvsroot/CMake/CMakeWeb/HTML/syntax.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** syntax.html	10 Mar 2008 15:56:38 -0000	1.1
--- syntax.html	11 Mar 2008 00:54:16 -0000	1.2
***************
*** 105,108 ****
--- 105,115 ----
          insensitive to command names. So where you see command you could use
          COMMAND or Command instead. </p>
+       <h2>Lists and Strings</h2>
+       The basic data type in CMake is a string. CMake also supports lists of strings. A list can be created with semi-colons as separators.  For example these two statements set the same value in to variable VAR:
+ <pre>
+   set(VAR a;b;c)
+   set(VAR a b c)
+ </pre>
+       <p>Lists of strings can be iterated with the foreach command or manipulated with the list command.</p>
        <h2>Variables</h2>
        <p>CMake supports simple variables that can be either strings or lists of strings. Variables are
***************
*** 115,125 ****
          command(&quot;${Foo}&quot;) would be invoked passing only one argument equivalent to command(
    &quot;a b c&quot; ). </p>
-       <h2>Lists and Strings</h2>
-       The basic data type in CMake is a string. CMake also supports lists of strings. A list can be created with semi-colons as separators.  For example these two statements set the same value in to variable VAR:
- <pre>
-   set(VAR a;b;c)
-   set(VAR a b c)
- </pre>
-       <p>Lists of strings can be iterated with the foreach command or manipulated with the list command.</p>
        <h2>Flow Control</h2>
        In many ways writing a CMakeLists file is like a writing a program in a simple language.
--- 122,125 ----
***************
*** 160,163 ****
--- 160,190 ----
          </ul>
  For more information on flow control see the documetation for the commands if, while, foreach, macro, and function.
+ <h2>Quotes, Strings and Escapes</h2>
+ A string literal in CMake is created with by enclosing it in double quotes.  Strings can be multi-line strings and will have embeded newlines in them. For example:
+ <pre>
+   set(MY_STRING "this is a string with a 
+   newline in 
+   it")
+ </pre>
+ You can also escape characters or use variables in a string.
+ <pre>
+   set(VAR "
+   hello
+   world
+   ")
+ message( "\${VAR} = ${VAR}")
+   # prints out
+   ${VAR} =
+   hello 
+   world
+ </pre>
+ Standard C like escapes are also supported.  
+ <pre>
+    message("\n\thello world")
+    # prints out
+    
+            hello world
+ </pre>
+ 
        <h2>Regular Expressions</h2>
        A few CMake commands, such as if and string, make use of regular expressions or can



More information about the Cmake-commits mailing list