43 set(oneValueArgs COMPONENT SUBDIRECTORY GROUP)
44 set(multiValueArgs
"")
45 cmake_parse_arguments(EXPORT_HEADER
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
47 # special
case for components:
remove prefix
for the destination directory
48 string(REGEX REPLACE
"^component-|^component_|^action-|^action_|^library_|^library-" "" EXPORT_HEADER_DESTINATION
"${EXPORT_HEADER_COMPONENT}")
50 # define where to install files 51 set(EXPORT_HEADER_INCLUDE_DIR ${CMAKE_BINARY_DIR}/
include/${CAMITK_SHORT_VERSION_STRING})
52 set(EXPORT_HEADER_INSTALL_ROOT ${CMAKE_INSTALL_PREFIX})
55 if(EXPORT_HEADER_GROUP)
57 if (NOT EXISTS
"${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}")
58 add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
60 COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}
61 COMMENT
"Creating build-time group include dir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_GROUP}" 65 set(EXPORT_HEADER_DESTINATION ${EXPORT_HEADER_GROUP}/${EXPORT_HEADER_DESTINATION})
68 # check that the directory exists otherwise create it 69 if (NOT EXISTS
"${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}")
70 add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
72 COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
73 COMMENT
"Creating build-time include dir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}" 78 # check the SUBDIRECTORY parameter 79 if(EXPORT_HEADER_SUBDIRECTORY)
80 set(EXPORT_HEADER_DESTINATION ${EXPORT_HEADER_DESTINATION}/${EXPORT_HEADER_SUBDIRECTORY})
81 # create subdirectory
if it does not exists
82 if (NOT EXISTS
"${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}")
83 add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
85 COMMAND ${CMAKE_COMMAND} -E make_directory ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}
86 COMMENT
"Creating build-time include subdir ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}" 93 # at build time, copy the files to build directory include files when the target is built 94 foreach(HEADER ${EXPORT_HEADER_UNPARSED_ARGUMENTS})
95 # check
if file name is relative or not
96 set(FILE_TO_COPY ${HEADER})
98 # copy after build, only
if there was
a change
99 add_custom_command(TARGET ${EXPORT_HEADER_COMPONENT}
101 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE_TO_COPY} ${EXPORT_HEADER_INCLUDE_DIR}/${EXPORT_HEADER_DESTINATION}/
102 COMMENT
"Installing build-time header ${HEADER}" 103 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
108 # during installation, copy the files to install directory 109 install(FILES ${EXPORT_HEADER_UNPARSED_ARGUMENTS}
110 # DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${CAMITK_SHORT_VERSION_STRING}/${EXPORT_HEADER_DESTINATION}/ 111 DESTINATION
include/${CAMITK_SHORT_VERSION_STRING}/${EXPORT_HEADER_DESTINATION}/
112 COMPONENT ${EXPORT_HEADER_COMPONENT}
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
export_headers()
export_headers is a macro that install header files at build and install time
Definition: ExportHeaders.h:40
static void include(QRect &r, const QRect &rect)
Definition: canvas_typed/qtcanvas.cpp:98