You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libsysstat-packaging/cmake/create_portable_headers.cmake

31 lines
1004 B

# Creates portable headers; e.g.:
# Creates XdgAction from xdgaction.h
# XdgAction contents:
# #include "xdgaction.h"
#
# Use:
# set(PUBLIC_CLASSES MyClass YourClass)
# create_portable_headers(PORTABLE_HEADERS ${PUBLIC_CLASSES})
# PORTABLE_HEADER is an return value that contains the full name of the
# generated headers.
function(create_portable_headers outfiles)
set(options)
set(oneValueArgs NAMESPACE)
set(multiValueArgs FILENAMES)
cmake_parse_arguments(_CREATE_PORTABLE_HEADERS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(prefix ${_CREATE_PORTABLE_HEADERS_NAMESPACE})
set(class_list ${_CREATE_PORTABLE_HEADERS_FILENAMES})
foreach(f ${class_list})
string(TOLOWER "${f}.h" _filename)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${f}
"#include \"../${_filename}\"")
list(APPEND ${outfiles} ${CMAKE_CURRENT_BINARY_DIR}/${f})
endforeach()
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
endfunction()