katie/cmake/modules/OptimizeHeaders.cmake
Ivailo Monev b241c8471f remove redundant QT_RCC and QT_UIC definitions
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2019-12-25 18:53:39 +00:00

18 lines
778 B
CMake

# Copyright (c) 2015-2019, Ivailo Monev, <xakepa10@gmail.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# UNIFDEF_EXECUTABLE, HEADERS_DIRECTORY and HEADERS_DEFINITIONS origin from the macro call
file(GLOB headers "$ENV{DESTDIR}/${HEADERS_DIRECTORY}/*.h")
message(STATUS "Optimizing header in: $ENV{DESTDIR}/${HEADERS_DIRECTORY}")
execute_process(
COMMAND ${UNIFDEF_EXECUTABLE} -m -UQT_BOOTSTRAPPED -UQT_MOC -UQT_ALLINONE ${HEADERS_DEFINITIONS} ${headers}
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()