[CMake] maximum length of a list

Hicham Mouline hicham at mouline.org
Sun Jun 27 16:53:54 EDT 2010


From: David Cole [mailto:david.cole at kitware.com] 
Sent: 27 June 2010 16:39
To: Hicham Mouline
Cc: cmake at cmake.org
Subject: Re: [CMake] maximum length of a list

 

On Sun, Jun 27, 2010 at 11:05 AM, Hicham Mouline <hicham at mouline.org> wrote:

hello

I assign the list of all directories the names of which starts with a
pattern like   pattern_.... to a cmake variable which I then pass as a
preprocessor macro:

FILE(GLOB MYPROJECT_LIST_SYSTEMS RELATIVE ${CMAKE_SOURCE_DIR} system_*)

MYPROJECT_LIST_SYSTEMS is then a cmake "list", a string with semicolon
separators.

What is the maximum number of entries in the list that cmake handles?
Or what is the maximum length of a cmake string?

 

In theory, it should be around 2G for 32-bit build of CMake.

 

In practice, I bet you'll run into the beginnings of performance issues if
you start to have strings that are 10s or 100s of megabytes large.

 

There's no hard-coded or stack-based limits in CMake that I'm aware of -- it
should be simply based on how much memory CMake can allocate... so:
hopefully, larger than anything you can throw at it... :-)

 

 

HTH,

David

 

That's totally all right then. I will probably never have more than 100
directories, ie a string of 100 max 20char length strings separated by semi
colon.

 

By the way, if I wish to replace the ; in the string by a , (comma)

should I just use STRING(REPLACE ";" "," ... )  ?

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100627/2c8c6af9/attachment.htm>


More information about the CMake mailing list