Re: [CMake] Passing Function Arguments

2010-07-08 Thread Johny
On 07/08/2010 10:44 AM, Michael Wild wrote: On 8. Jul, 2010, at 10:35 , Johny wrote: I am trying to write a cmake function which imitates the functionality of wc -l for unix. However i can't seem to be able to figure out how to store the result into the variable which is passed to the fu

Re: [CMake] Passing Function Arguments

2010-07-08 Thread Ryan Pavlik
function (wcl _fileName _varName) set(out 0) file(READ "${_fileName}" fileData) if(fileData) string(REGEX MATCHALL "\n" lines "${fileData}") list(LENGTH lines out) endif() set(${+varName} ${out} PARENT_SCOPE) endfunction() Key parts you missed: "lines" (now _varName) contains a

Re: [CMake] Passing Function Arguments

2010-07-08 Thread Michael Wild
On 8. Jul, 2010, at 10:35 , Johny wrote: > I am trying to write a cmake function which imitates the functionality of wc > -l for unix. However i can't seem to be able to figure out how to store the > result into the variable which is passed to the function. > > function (wcl fileName lines) >

[CMake] Passing Function Arguments

2010-07-08 Thread Johny
I am trying to write a cmake function which imitates the functionality of wc -l for unix. However i can't seem to be able to figure out how to store the result into the variable which is passed to the function. function (wcl fileName lines) file(READ ${fileName} fileData) if(fileData)