Re: [CMake] Parameters of functions

2011-05-12 Thread Micha Renner
Am Donnerstag, den 12.05.2011, 17:10 +0200 schrieb Michael Wild: > I agree, that this behaviour is due the fact that the parameter name > "var" hides the parent-scope variable "var", but then ${${var}} should > IMHO result in an error or warning message. Essentially, what this does > inside the fun

Re: [CMake] Parameters of functions

2011-05-12 Thread Michael Wild
I agree, that this behaviour is due the fact that the parameter name "var" hides the parent-scope variable "var", but then ${${var}} should IMHO result in an error or warning message. Essentially, what this does inside the function is set(var var) which is hardly ever what is intended. This could

Re: [CMake] Parameters of functions

2011-05-12 Thread Glenn Coombs
If you really wanted to pass the name of the variable in rather than the value, then as Rolf says the behaviour you get is as expected. The only way round that would be to rename var in the function to something guaranteed not to be the name of a variable that you ever tried to pass in. Or you co

Re: [CMake] Parameters of functions

2011-05-12 Thread Micha Renner
Am Donnerstag, den 12.05.2011, 11:50 +0100 schrieb Glenn Coombs: > I think you probably wanted to write and call your function like this: > > FUNCTION(build var) >MESSAGE(STATUS "var: ${var}") > ENDFUNCTION(build) > > SET(var red blue yellow green) > build("${var}") > > That prints out a

Re: [CMake] Parameters of functions

2011-05-12 Thread Michael Wild
Often one wants to pass in the *name* of a variable (i.e. the name of list, like for list(APPEND name ...)), so Rolf's code does make sense. Haven't had the time to try the test-case myself, though... Michael On 05/12/2011 12:50 PM, Glenn Coombs wrote: > I think you probably wanted to write and c

Re: [CMake] Parameters of functions

2011-05-12 Thread Glenn Coombs
I think you probably wanted to write and call your function like this: FUNCTION(build var) MESSAGE(STATUS "var: ${var}") ENDFUNCTION(build) SET(var red blue yellow green) build("${var}") That prints out as you would expect: -- var: red;blue;yellow;green -- Glenn On 12 May 2011 07:27,

Re: [CMake] Parameters of functions

2011-05-11 Thread Rolf Eike Beer
> This is funny: > FUNCTION(build var) > MESSAGE(STATUS "var: " ${${var}}) > ENDFUNCTION(build) > > SET(var red blue yellow green) > build(var) > > Output: > -- var: var > > SET(varX red blue yellow green) > build(varX) > Output: > -- var: redblueyellowgreen No, it must be that way. Inside b

[CMake] Parameters of functions

2011-05-11 Thread Micha Renner
This is funny: FUNCTION(build var) MESSAGE(STATUS "var: " ${${var}}) ENDFUNCTION(build) SET(var red blue yellow green) build(var) Output: -- var: var SET(varX red blue yellow green) build(varX) Output: -- var: redblueyellowgreen Greetings Micha

Re: [CMake] parameters

2009-03-12 Thread lari...@gmail.com
Tyler Roscoe wrote: On Wed, Mar 11, 2009 at 09:39:30AM +0200, lari...@gmail.com wrote: How can i specify the following parameters in my CMakeLists.txt? cmake -DCMAKE_THREAD_LIBS:STRING="-pthread" -DCMAKE_USE_PTHREADS:BOOL=ON -DCMAKE_EXE_LINKER_FLAGS:STRING="-pthread" Maybe I don't un

Re: [CMake] parameters

2009-03-11 Thread Tyler Roscoe
On Wed, Mar 11, 2009 at 09:39:30AM +0200, lari...@gmail.com wrote: > How can i specify the following parameters in my CMakeLists.txt? > cmake -DCMAKE_THREAD_LIBS:STRING="-pthread" -DCMAKE_USE_PTHREADS:BOOL=ON > -DCMAKE_EXE_LINKER_FLAGS:STRING="-pthread" Maybe I don't understand the question but

[CMake] parameters

2009-03-11 Thread lari...@gmail.com
How can i specify the following parameters in my CMakeLists.txt? cmake -DCMAKE_THREAD_LIBS:STRING="-pthread" -DCMAKE_USE_PTHREADS:BOOL=ON -DCMAKE_EXE_LINKER_FLAGS:STRING="-pthread" P.S. Sorry for my English:) ___ Powered by www.kitware.com Visit oth