ClhepCopyHeaders.cmake 2.3 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
     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} )
34
35
36
37
       #STRING( REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/${package}  ${CLHEP_BINARY_DIR}/CLHEP output_file ${hdr})
       set(output_dir ${CLHEP_BINARY_DIR}/CLHEP/${package})
       get_filename_component(shorthdr ${hdr} NAME)
       ##message(STATUS "moving ${shorthdr} to ${output_dir}")
38
       # this copies the file and creates directories if necessary
39
       CONFIGURE_FILE( ${hdr} ${output_dir}/${shorthdr}  COPYONLY )
40
41
     endforeach( hdr )
  endforeach(package)
Lynn Garren's avatar
Lynn Garren committed
42
43
44
45
46
47
  # 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 )
Vassil Vassilev's avatar
Vassil Vassilev committed
48
49
50
51
52

  # handle the module.modulemap file
  CONFIGURE_FILE( ${CLHEP_SOURCE_DIR}/module.modulemap ${CLHEP_BINARY_DIR}/module.modulemap COPYONLY )
  INSTALL (FILES ${CLHEP_BINARY_DIR}/module.modulemap
           DESTINATION include )
Lynn Garren's avatar
Lynn Garren committed
53
  
54
endmacro (clhep_copy_headers)