1CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) 2 3SET( SOURCES back.c io.c main.c ) 4SET( PATH $ENV{PATH} ) 5MESSAGE( ${SOURCES} ) # three arguments, prints "back.cio.cmain.c" 6MESSAGE( "${SOURCES}" ) # one argument, prints "back.c;io.c;main.c" 7MESSAGE( "" ) # one argument, prints "" an empty line 8MESSAGE( "${EMPTY_STRING}" ) # one argument, prints "" an empty line 9MESSAGE( ${EMPTY_STRING} ) # zero arguments, causes CMake Error 10 # "MESSAGE called with incorrect number of arguments" 11MESSAGE( \\\"\ \(\)\#\$\^ ) # this message contains literal characters 12 13MESSAGE( "This is practice." ) # prints "This is practice." 14MESSAGE( "This;is;practice." ) # prints "This;is;practice." 15MESSAGE( "Hi. ) MESSAGE( x )" ) # prints "Hi. ) MESSAGE( x )" 16 17MESSAGE( "Welc"ome ) # rule 1 18MESSAGE( Welc"ome" ) # rule 3 19MESSAGE( Welc"ome)" ) # rule 2 20MESSAGE( ""Thanks ) # rule 1 21MESSAGE( Thanks"" ) # rule 3 22 23SET( x y A B C ) # stores "y;A;B;C" in x (without quote) 24SET( ${x} ) # => SET( y;A;B;C ) => SET( y A B C) 25MESSAGE( ${y} ) # prints "ABC" to stdout (without quotes) 26SET( y x ) # stores "x" in y (without quotes) 27SET( ${y} y = x ) # => SET( x y ) 28MESSAGE( "\${x} = '${x}'" ) # prints "${x} = 'y;=;x'" to stdout (without quotes) 29SET( y ${x} ) # => SET( y y = x ) => stores "y;=;x" in y (without quotes) 30MESSAGE( ${y} ) # prints "y=x" to stdout (without quotes) 31 32SET( x a b c ) # stores "a;b;c" in x (without quotes) 33SET( y "a b c" ) # stores "a b c" in y (without quotes) 34MESSAGE( a b c ) # prints "abc" to stdout (without quotes) 35MESSAGE( ${x} ) # prints "abc" to stdout (without quotes) 36MESSAGE("${x}") # prints "a;b;c" to stdout (without quotes) 37MESSAGE( ${y} ) # prints "a b c" to stdout (without quotes) 38MESSAGE("${y}") # prints "a b c" to stdout (without quotes) 39 40# This is a comment. 41COMMAND( arguments go here ) 42ANOTHER_COMMAND() # this command has no arguments 43YET_ANOTHER_COMMAND( these 44 arguments are spread # another comment 45 over several lines ) 46