Go to the documentation of this file.00001 ##############################################################################
00002 # @file ConfigureIncludeFiles.cmake
00003 # @brief CMake script used to configure and copy the public header files.
00004 #
00005 # Besides configuring the files, this script optionally copies the header
00006 # files to the build tree using the final relative path as used for the
00007 # installation. This could be done directly during the configure step of
00008 # CMake by code executed as part of the CMakeLists.txt files, but then
00009 # whenever a header file is modified, CMake reconfigures the build system.
00010 # Instead, this script is executed using execute_process() during the
00011 # configure step of CMake and a custom build target is added which rebuilds
00012 # whenever a header file was modified. Thus, only this script is re-executed,
00013 # but not the entire build system re-configured.
00014 #
00015 # The relative path of each configured input header file in the source tree
00016 # is appended to the output log file. This file can be used to determine
00017 # whether a new header was added to the source tree and thus this script has
00018 # to be re-executed.
00019 #
00020 # Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.<br />
00021 # See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
00022 #
00023 # Contact: SBIA Group <sbia-software at uphs.upenn.edu>
00024 #
00025 # @ingroup CMakeUtilities
00026 ##############################################################################
00027
00028 # ----------------------------------------------------------------------------
00029 # requires bug fixed get_filename_component() of BASIS tools
00030 include ("${CMAKE_CURRENT_LIST_DIR}/CommonTools.cmake")
00031
00032 # ----------------------------------------------------------------------------
00033 # check arguments
00034 if (NOT PROJECT_INCLUDE_DIRS)
00035 message (FATAL_ERROR "Missing argument PROJECT_INCLUDE_DIR!")
00036 endif ()
00037
00038 if (NOT BINARY_INCLUDE_DIR)
00039 message (FATAL_ERROR "Missing argument BINARY_INCLUDE_DIR!")
00040 endif ()
00041
00042 if (NOT EXTENSIONS)
00043 message (FATAL_ERROR "Missing argument EXTENSIONS!")
00044 endif ()
00045
00046 if (NOT INCLUDE_PREFIX)
00047 set (INCLUDE_PREFIX "")
00048 endif ()
00049
00050 if (NOT VARIABLE_NAME)
00051 set (VARIABLE_NAME "PUBLIC_HEADERS")
00052 endif ()
00053
00054 # ----------------------------------------------------------------------------
00055 # include file which defines CMake variables for use in .h.in files
00056 if (INCLUDE_FILE)
00057 include ("${INCLUDE_FILE}")
00058 endif ()
00059
00060 # ----------------------------------------------------------------------------
00061 # configure header files
00062 set (_CONFIGURED_HEADERS)
00063 get_filename_component (INCLUDE_PREFIX_DIR "${INCLUDE_PREFIX}" PATH)
00064 basis_sanitize_for_regex (INCLUDE_PREFIX_REGEX "${INCLUDE_PREFIX}")
00065 basis_sanitize_for_regex (INCLUDE_PREFIX_DIR_REGEX "${INCLUDE_PREFIX_DIR}")
00066 foreach (INCLUDE_DIR IN LISTS PROJECT_INCLUDE_DIRS)
00067 # glob header files
00068 set (GLOB_EXPR)
00069 foreach (E IN LISTS EXTENSIONS)
00070 list (APPEND GLOB_EXPR "${INCLUDE_DIR}
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175