Commit 2ec91bff authored by Andreas Schuh's avatar Andreas Schuh

Move definition of configure_sources CMake function to utils module.

parent ffbc1cea
......@@ -114,19 +114,6 @@ else ()
set (__ATTRIBUTE__UNUSED)
endif ()
function (configure_sources out)
set (tmp)
foreach (src IN LISTS ARGN)
if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
else ()
list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}")
endif ()
endforeach ()
set (${out} "${tmp}" PARENT_SCOPE)
endfunction ()
configure_sources (PUBLIC_HDRS ${PUBLIC_HDRS})
configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS})
configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS})
......
## @file utils.cmake
# @brief Utility CMake functions.
## Utility CMake functions.
# ----------------------------------------------------------------------------
## @brief Extract version numbers from version string.
#
# @param [in] VERSION Version string in the format "MAJOR[.MINOR[.PATCH]]".
# @param [out] MAJOR Major version number if given or 0.
# @param [out] MINOR Minor version number if given or 0.
# @param [out] PATCH Patch number if given or 0.
#
# @returns See @c [out] parameters.
## Extract version numbers from version string.
function (version_numbers VERSION MAJOR MINOR PATCH)
if (VERSION MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
if (CMAKE_MATCH_1)
......@@ -38,3 +30,18 @@ function (version_numbers VERSION MAJOR MINOR PATCH)
set ("${MINOR}" "${VERSION_MINOR}" PARENT_SCOPE)
set ("${PATCH}" "${VERSION_PATCH}" PARENT_SCOPE)
endfunction ()
# ----------------------------------------------------------------------------
## Configure source files with .in suffix
function (configure_sources out)
set (tmp)
foreach (src IN LISTS ARGN)
if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in")
configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}" @ONLY)
list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_NAMESPACE}/${src}")
else ()
list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}")
endif ()
endforeach ()
set (${out} "${tmp}" PARENT_SCOPE)
endfunction ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment