Use the lxqt-build-tools LXQtCreatePortableHeaders
authorLuís Pereira <luis.artur.pereira@gmail.com>
Tue, 11 Oct 2016 21:43:29 +0000 (22:43 +0100)
committerLuís Pereira <luis.artur.pereira@gmail.com>
Tue, 11 Oct 2016 21:43:29 +0000 (22:43 +0100)
Drop the local version.

CMakeLists.txt
cmake/create_portable_headers.cmake [deleted file]

index 2edbb61..da661d0 100644 (file)
@@ -161,7 +161,7 @@ set(LXQT_PKG_CONFIG_REQUIRES "Qt5Xdg >= ${QTXDG_MINIMUM_VERSION}, Qt5Widgets >=
 include(LXQtCompilerSettings NO_POLICY_SCOPE)
 include(LXQtCreatePkgConfigFile)
 include(cmake/FindInstallConfigPath.cmake) # sets LXQT_ETC_XDG_DIR, if unset
-include(create_portable_headers)
+include(LXQtCreatePortableHeaders)
 
 set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION})
 set(LXQT_LIBRARY_NAME "lxqt" CACHE STRING "lxqt")
@@ -211,8 +211,13 @@ foreach(h ${PUB_HDRS})
 endforeach()
 
 # Create the portable headers
-create_portable_headers(INTREE_PORTABLE_HEADERS "${LXQT_INTREE_INCLUDE_DIR}/LXQt" ${PUBLIC_CLASSES})
-check_portable_headers(H_FILES ${PUB_HDRS} LINKS "${INTREE_PORTABLE_HEADERS}")
+lxqt_create_portable_headers(INTREE_PORTABLE_HEADERS
+    NAME_PREFIX "lxqt"
+    OUTPUT_DIR "${LXQT_INTREE_INCLUDE_DIR}/LXQt"
+    HEADER_NAMES ${PUBLIC_CLASSES}
+)
+
+#check_portable_headers(H_FILES ${PUB_HDRS} LINKS "${INTREE_PORTABLE_HEADERS}")
 
 #************************************************
 # Create in-tree build infrastructure
diff --git a/cmake/create_portable_headers.cmake b/cmake/create_portable_headers.cmake
deleted file mode 100644 (file)
index d2537ad..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# 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 outDir)
-    set(options)
-    set(oneValueArgs)
-    set(multiValueArgs)
-
-    cmake_parse_arguments(_CREATE_PORTABLE_HEADERS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-    set(class_list ${_CREATE_PORTABLE_HEADERS_UNPARSED_ARGUMENTS})
-    foreach(f ${class_list})
-        string(TOLOWER "${f}.h" _filename)
-
-        file(WRITE "${outDir}/${f}"
-            "#include \"lxqt${_filename}\"\n")
-
-        list(APPEND ${outfiles} "${outDir}/${f}")
-    endforeach()
-
-    set(${outfiles} "${${outfiles}}" PARENT_SCOPE)
-endfunction()
-
-
-
-function(check_portable_headers)
-    cmake_parse_arguments(__ARGS "" "" "H_FILES;LINKS" ${ARGN})
-
-    foreach(f ${__ARGS_LINKS})
-        file(READ ${f} content)
-
-        set(found False)
-        foreach(line ${content})
-            string(REGEX MATCH "#include \"(.*)\"" v ${line})
-            set(hFile ${CMAKE_MATCH_1})
-
-            string(REGEX MATCH "[;/]${hFile};" v ";${__ARGS_H_FILES};")
-
-            if(NOT v)
-                set(found True)
-            endif()
-        endforeach()
-
-
-        if(found)
-            message(FATAL_ERROR "Incorrect portable header: '${f}'")
-        endif()
-
-    endforeach()
-endfunction()
-