[CMake] Best way to Generate String

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Fri Mar 5 18:20:38 EST 2010


Is this the best way to generate a comment bar, such as this:

////////////////////////////////////////////////////////////////////////////////

or this:

--------------------------------------------------------------------------------

or this:

################################################################################

IF(OUTPUT_FILE_EXT MATCHES "^\\.h|\\.cpp$")
   SET(COMMENT_CHARACTER "/")
ELSEIF(OUTPUT_FILE_EXT MATCHES "^\\.sql$")
   SET(COMMENT_CHARACTER "-")
ELSEIF(OUTPUT_FILE_EXT MATCHES "^\\.nsi|\\.nsh$")
   SET(COMMENT_CHARACTER "#")
ELSE()
   MESSAGE(WARNING "Unknown file type")
ENDIF()

STRING(RANDOM LENGTH 80 ALPHABET "${COMMENT_CHARACTER}" COMMENT_BAR)

The only reason I ask is that is seems weird to use the STRING(RANDOM 
function to get this done.
-------------------------------------------------------------
Aaron Wright
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100305/b5599927/attachment.htm>


More information about the CMake mailing list