[CMake] subdirectories INSTALL(FILES "subdir/foo.h" ...)

Jan Woetzel jw at mip.informatik.uni-kiel.de
Fri Jun 30 14:23:59 EDT 2006


Brad King wrote:

> You can probably do what you want in CMake code with a combination of 
> FILE(GLOB) and IF(IS_DIRECTORY).
>
> INSTALL(DIRECTORY ...) option.  There is a feature request already in 
> the bug tracker for this but it has not yet been implemented.


For the records - this works:


FILE(GLOB_RECURSE BIAS_HEADER RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h* )
FOREACH(VAR ${BIAS_HEADER})
  # drop headers from Example dir and .in files
  IF   (${VAR} MATCHES ".*Example.*|.*\\.in")
    REMOVE(BIAS_HEADER "${VAR}")
  ELSE (${VAR} MATCHES ".*Example.*|.*\\.in")
    # extract directoy for DESTINATION subdir tree until 
INSTALL(DIRECTORY exists)
    GET_FILENAME_COMPONENT(DIR ${VAR} PATH)
    INSTALL(FILES  ${BIAS_HEADER} DESTINATION include/BIAS/${DIR} )
  ENDIF(${VAR} MATCHES ".*Example.*|.*\\.in")
ENDFOREACH(VAR) 


Jan.

-- 

  Dipl.-Ing. Jan Woetzel
--------------------------------------------------
  University of Kiel
  Institute of Computer Science and Applied Mathematics
  Hermann-Rodewald-Str. 3 [room 310]
  24098 Kiel/Germany
--------------------------------------------------
  Phone +49-431-880-4477
  Fax   +49-431-880-4054
  Mob.  +49-179-2937346
--------------------------------------------------
  Url   www.mip.informatik.uni-kiel.de/~jw
  Email jw at mip.informatik.uni-kiel.de



More information about the CMake mailing list