[CMake] UseCopyright.cmake module

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Sep 8 18:03:35 EDT 2008


'lo there,

I have written a very silly cmake module:

http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/UseCopyright.cmake?view=markup

...
# Handy macro to gather all copyright in a single file (to pass to cpack)

MACRO(CREATE_COPYRIGHT_FILE name)
  # Always cleanup the file:
  FILE(WRITE ${name} "")
  SET(COPYRIGHT_MODULE_FILENAME ${name})
ENDMACRO(CREATE_COPYRIGHT_FILE)

# Append copyright file
MACRO(APPEND_COPYRIGHT)
  # need to raise an error if COPYRIGHT_MODULE_FILENAME is not set...
  IF(EXISTS ${COPYRIGHT_MODULE_FILENAME} )
    FOREACH(filename ${ARGN})
      FILE(READ ${filename} content)
      FILE(APPEND ${COPYRIGHT_MODULE_FILENAME} ${content})
    ENDFOREACH(filename)
  ENDIF(EXISTS ${COPYRIGHT_MODULE_FILENAME} )
ENDMACRO(APPEND_COPYRIGHT)
...


This comes handy when you are adding third party library and want to
append the copyright file only if user selected some option (much like
VTK and system lib like png/zlib/expat...)

2cts
-- 
Mathieu


More information about the CMake mailing list