45 set(oneValueArgs COMPONENT GROUP)
46 set(multiValueArgs
"")
47 cmake_parse_arguments(CAMITK_INSTALL_ALL_HEADERS
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
50 set(CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR ${CMAKE_BINARY_DIR}/
include/${CAMITK_SHORT_VERSION_STRING})
51 set(CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR
include/${CAMITK_SHORT_VERSION_STRING})
53 # Get action, component or library name without its prefix
54 set(CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME ${CAMITK_INSTALL_ALL_HEADERS_COMPONENT})
55 string(REGEX REPLACE
"^component-|^component_|^action-|^action_|^library_|^library-" "" CAMITK_INSTALL_ALL_HEADERS_COMPONENT
"${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}")
57 # Check group directory 58 if(CAMITK_INSTALL_ALL_HEADERS_GROUP)
59 # Create group directory if not already existing 60 if (NOT EXISTS
"${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_GROUP}" AND NOT CAMITK_INSTALL_ALL_HEADERS_DIRECTORY)
61 add_custom_command( TARGET ${CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME}
63 COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_GROUP}
64 COMMENT
"Creating build-time group include dir ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_GROUP}" 69 set(CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_GROUP})
70 set(CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR ${CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_GROUP})
73 # Create component directory if not already existing 74 if (NOT EXISTS
"${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}" AND NOT CAMITK_INSTALL_ALL_HEADERS_DIRECTORY)
75 add_custom_command( TARGET ${CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME}
77 COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}
78 COMMENT
"Creating build-time include dir ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}" 83 set(CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_COMPONENT})
84 set(CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR ${CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR}/${CAMITK_INSTALL_ALL_HEADERS_COMPONENT})
86 # Build time installation
87 file(GLOB_RECURSE HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ *.h)
88 foreach(HEADER ${HEADERS})
89 # Get the subdirectory name of the header
90 string(REGEX MATCH
".*/" SUBDIR ${HEADER})
92 # Create subdirectory
if not already existing
93 if(NOT EXISTS
"${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${SUBDIR}" AND NOT CAMITK_INSTALL_ALL_HEADERS_${SUBDIR})
94 # Create directory at build time
95 add_custom_command( TARGET ${CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME}
97 COMMAND ${CMAKE_COMMAND} -E make_directory ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${SUBDIR}
98 COMMENT
"Creating build-time include dir ${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}/${SUBDIR}" 101 set(CAMITK_INSTALL_ALL_HEADERS_${SUBDIR}
"CREATED") # To avoid creating the directory another time
104 # Install header at build time 105 add_custom_command( TARGET ${CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME}
107 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} ${CAMITK_INSTALL_ALL_HEADERS_BUILD_BASE_DIR}/${SUBDIR}
108 COMMENT
"Installing build-time header ${CAMITK_INSTALL_ALL_HEADERS_COMPONENT}/${HEADER}" 113 # Install time, copy all the .h directories structure 114 install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
115 COMPONENT ${CAMITK_INSTALL_ALL_HEADERS_TARGET_NAME}
116 DESTINATION ${CAMITK_INSTALL_ALL_HEADERS_INSTALL_RELATIVE_DIR}
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
camitk_install_all_headers()
camitk_install_all_headers is a macro that install all header files of a project at build and install...
Definition: CamiTKInstallAllHeaders.h:42
static void include(QRect &r, const QRect &rect)
Definition: canvas_typed/qtcanvas.cpp:98