review build time warnings and fatal errors

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-30 18:33:50 +00:00
parent d5ac3a435c
commit a99598da12
2 changed files with 10 additions and 11 deletions

View file

@ -10,9 +10,9 @@
cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR)
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "\nThe project should not be build in the source directory")
message(FATAL_ERROR "The project should not be build in the source directory")
elseif(CMAKE_CROSSCOMPILING AND NOT KATIE_CROSS_EXEC)
message(FATAL_ERROR "\nCross-compiling requires KATIE_CROSS_EXEC to be set to QEMU executable, e.g. qemu-arm-static")
message(FATAL_ERROR "Cross-compiling requires KATIE_CROSS_EXEC to be set to QEMU executable, e.g. qemu-arm-static")
endif()
project(Katie C CXX)
@ -67,6 +67,12 @@ elseif(CMAKE_HOST_SYSTEM_PROCESSOR)
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" KATIE_PROCESSOR)
endif()
# used in katie_optimize_headers()
find_program(KATIE_UNIFDEF NAMES unifdef)
if(NOT KATIE_UNIFDEF)
message(WARNING "Could not find unifdef, headers will not be optimized")
endif()
# used as shebang for profile, exec, dbg and trace scripts
find_program(KATIE_SHELL NAMES sh dash mksh ksh ash)
if(NOT KATIE_SHELL)
@ -425,10 +431,7 @@ configure_file(
)
if(KATIE_TESTS OR KATIE_BENCHMARKS)
message(WARNING
"\nUnless it is intentionall you should not enable testing, deploying tests builds"
" is a bad idea."
)
message(WARNING "Deploying tests builds is a bad idea")
enable_testing()
add_definitions(-DQT_BUILD_INTERNAL)
endif()

View file

@ -297,17 +297,13 @@ endmacro()
# a macro to remove conditional code from headers which is only relevant to the
# process of building Katie itself
macro(KATIE_OPTIMIZE_HEADERS DIR)
find_program(unifdef NAMES unifdef)
if(unifdef)
if(KATIE_UNIFDEF)
install(
CODE "set(UNIFDEF_EXECUTABLE \"${unifdef}\")"
CODE "set(HEADERS_DIRECTORY \"${DIR}\")"
CODE "set(HEADERS_DEFINITIONS \"${ARGN}\")"
SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/OptimizeHeaders.cmake"
)
else()
get_filename_component(basename "${DIR}" NAME)
message(WARNING "unifdef not installed, cannot optimize headers for: ${basename}")
endif()
endmacro()