diff options
author | Aleix Pol <aleixpol@kde.org> | 2013-12-27 13:56:21 +0100 |
---|---|---|
committer | Aleix Pol <aleixpol@kde.org> | 2013-12-27 13:56:21 +0100 |
commit | 809726ddd7b920c1d0c5a5339c344d91b88c59ef (patch) | |
tree | 8f1c4f214977215cce2d24892cdd8c813859d152 /modules | |
parent | 83f4d25981610a0357284084543c4896155cab4e (diff) | |
download | extra-cmake-modules-809726ddd7b920c1d0c5a5339c344d91b88c59ef.tar.gz extra-cmake-modules-809726ddd7b920c1d0c5a5339c344d91b88c59ef.tar.bz2 |
Add the REQUIRED_HEADERS and RELATIVE arguments
RELATIVE is needed because some projects have their headers (and sources)
split into different subdirectories.
REQUIRED_HEADERS gives the opportunity to receive a list of all the headers
we're depending on, in case the user wants to re-use it.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ECMGenerateHeaders.cmake | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/ECMGenerateHeaders.cmake b/modules/ECMGenerateHeaders.cmake index 963e13b9..7fac1649 100644 --- a/modules/ECMGenerateHeaders.cmake +++ b/modules/ECMGenerateHeaders.cmake @@ -12,7 +12,8 @@ # # ECM_GENERATE_HEADERS( ClassA ClassB ... # [MODULE_NAME name] -# [OUTPUT_DIR path]) +# [OUTPUT_DIR path] +# [REQUIRED_HEADERS variable]) # # The MODULE_NAME argument is used to provide information about where the # directories will be generated. By default, PROJECT_NAME will be used in both @@ -22,6 +23,13 @@ # should be within the build directory. By default, CMAKE_CURRENT_BINARY_DIR # will be used. # +# The REQUIRED_HEADERS argument will receive an output variable name where all +# the required headers will be appended so that they can be installed together +# with the generated ones. +# +# The RELATIVE argument will specify where are the original headers from the +# current directory. +# # # Copyright (c) 2013, Aleix Pol Gonzalez <aleixpol@blue-systems.com> # @@ -32,7 +40,7 @@ include(CMakeParseArguments) function(ECM_GENERATE_HEADERS) - set(oneValueArgs MODULE_NAME OUTPUT_DIR) + set(oneValueArgs MODULE_NAME OUTPUT_DIR REQUIRED_HEADERS RELATIVE) cmake_parse_arguments(EGH "" "${oneValueArgs}" "" ${ARGN}) if(NOT EGH_MODULE_NAME) set(EGH_MODULE_NAME ${PROJECT_NAME}) @@ -47,7 +55,7 @@ function(ECM_GENERATE_HEADERS) string(TOLOWER ${_CLASSNAME} lowercaseclassname) set(REGULAR_HEADER_NAME ${EGH_OUTPUT_DIR}/${lowercasemodule}/${lowercaseclassname}.h) set(FANCY_HEADER_NAME ${EGH_OUTPUT_DIR}/${EGH_MODULE_NAME}/${_CLASSNAME}) - set(_actualheader "${CMAKE_CURRENT_SOURCE_DIR}/${lowercaseclassname}.h") + set(_actualheader "${CMAKE_CURRENT_SOURCE_DIR}/${EGH_RELATIVE}/${lowercaseclassname}.h") if (NOT EXISTS ${_actualheader}) message(FATAL_ERROR "Could not find \"${_actualheader}\"") endif() @@ -57,5 +65,9 @@ function(ECM_GENERATE_HEADERS) if (NOT EXISTS ${FANCY_HEADER_NAME}) file(WRITE ${FANCY_HEADER_NAME} "#include \"${lowercasemodule}/${lowercaseclassname}.h\"\n") endif() + list(APPEND REQUIRED_HEADERS "${_actualheader}") endforeach() + if (NOT EGH_REQUIRED_HEADERS STREQUAL "") + set(${EGH_REQUIRED_HEADERS} ${${EGH_REQUIRED_HEADERS}} ${REQUIRED_HEADERS} PARENT_SCOPE) + endif () endfunction() |