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
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
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)
>
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)