ClhepCopyHeaders.cmake 1.98 KB
Newer Older
1
2
3
4
5
6
# since the CLHEP source code installation does not have the
# expected header paths, install headers in the build directory
#
# Recommended use:
# clhep_copy_headers( <package_list> )

7
include(ClhepParseVersion)
Lynn Garren's avatar
Lynn Garren committed
8

9
10
11
macro (clhep_copy_headers )
  foreach( package ${ARGN} )
     message(STATUS "checking for headers in ${package}")
Lynn Garren's avatar
Lynn Garren committed
12
13
14
15
16
17
18
     string(TOUPPER ${package} UPACKAGE )
     set( PACKAGE ${package} )
     if( found_drand48 )
       set( DRAND48_DEF "#define HAVE_DRAND48 1" )
     else()
       set( DRAND48_DEF "#undef HAVE_DRAND48" )
     endif()
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
     FILE( GLOB headers 
                ${CLHEP_SOURCE_DIR}/${package}/${package}/*.h
                ${CLHEP_SOURCE_DIR}/${package}/${package}/*.hh
                ${CLHEP_SOURCE_DIR}/${package}/${package}/*.icc )
     FILE( GLOB defs ${CLHEP_SOURCE_DIR}/${package}/${package}/cmake-defs.h.in )
     foreach( defhdr ${defs} )
       ##message(STATUS "process ${defhdr} to create ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h")
       # this copies the file and creates directories if necessary
       CONFIGURE_FILE( ${defhdr} ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h  @ONLY )
       # install defs.h from here
       INSTALL (FILES ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h
        	DESTINATION include/CLHEP/${package} )
     endforeach( defhdr )

     foreach( hdr ${headers} )
       STRING( REGEX REPLACE "^(${CMAKE_CURRENT_SOURCE_DIR})/${package}(.*)$"  "${CLHEP_BINARY_DIR}/CLHEP\\2" output_file "${hdr}")
       ##message(STATUS "moving ${hdr} to ${output_file}")
       # this copies the file and creates directories if necessary
       CONFIGURE_FILE( ${hdr} ${output_file}  COPYONLY)
     endforeach( hdr )
  endforeach(package)
Lynn Garren's avatar
Lynn Garren committed
40
41
42
43
44
45
46
  # get ClhepVersion.h
  parse_version( CLHEP ${VERSION} )
  CONFIGURE_FILE( ${CLHEP_SOURCE_DIR}/cmake/Templates/ClhepVersion.h.in 
                  ${CLHEP_BINARY_DIR}/CLHEP/ClhepVersion.h  @ONLY )
  INSTALL (FILES ${CLHEP_BINARY_DIR}/CLHEP/ClhepVersion.h
           DESTINATION include/CLHEP )
  
47
endmacro (clhep_copy_headers)