2021-02-05 06:13:36 +02:00
|
|
|
# Copyright (C) 2015, Ivailo Monev, <xakepa10@gmail.com>
|
2019-05-13 00:59:14 +00:00
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
|
2016-05-25 17:09:37 +00:00
|
|
|
# UNIFDEF_EXECUTABLE, HEADERS_DIRECTORY and HEADERS_DEFINITIONS origin from the macro call
|
2015-12-10 05:06:13 +02:00
|
|
|
|
|
|
|
file(GLOB headers "$ENV{DESTDIR}/${HEADERS_DIRECTORY}/*.h")
|
|
|
|
|
|
|
|
message(STATUS "Optimizing header in: $ENV{DESTDIR}/${HEADERS_DIRECTORY}")
|
2015-12-21 23:32:05 +02:00
|
|
|
execute_process(
|
2020-07-23 12:29:41 +00:00
|
|
|
COMMAND ${UNIFDEF_EXECUTABLE} -m -UQT_BOOTSTRAPPED -UQT_MOC ${HEADERS_DEFINITIONS} ${headers}
|
2015-12-21 23:32:05 +02:00
|
|
|
RESULT_VARIABLE unifdef_result
|
|
|
|
ERROR_VARIABLE unifdef_output
|
|
|
|
OUTPUT_VARIABLE unifdef_output
|
|
|
|
)
|
|
|
|
# unifdef exits with status 1 if the output differes, see its man page
|
|
|
|
if(unifdef_result GREATER 1)
|
|
|
|
message(FATAL_ERROR "${unifdef_output} (${unifdef_result})")
|
|
|
|
endif()
|