From 8e2ce83987d26077d28bd26342100683ea35d2f1 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 11 Apr 2018 20:20:19 +0200 Subject: Check if the application androiddeployqt package has a main() symbol Summary: Back in the KDE Edu sprint, we decided we need such a check, otherwise you get rather frustrated when the application isn't started. A patch to androiddeployqt was submitted but rejected by the maintainer. https://codereview.qt-project.org/#/c/207941/ Test Plan: kate doesn't build if we don't pass Q_DECL_EXPORT, builds if we do. Reviewers: #frameworks, #build_system, vkrause Reviewed By: vkrause Subscribers: vkrause, vatra, aacid Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D12120 --- toolchain/hasMainSymbol.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 toolchain/hasMainSymbol.cmake (limited to 'toolchain/hasMainSymbol.cmake') diff --git a/toolchain/hasMainSymbol.cmake b/toolchain/hasMainSymbol.cmake new file mode 100644 index 00000000..9a041e73 --- /dev/null +++ b/toolchain/hasMainSymbol.cmake @@ -0,0 +1,10 @@ +execute_process(COMMAND nm --dynamic ${TARGET} ERROR_VARIABLE nm_errors OUTPUT_VARIABLE out RESULT_VARIABLE result) + +if (NOT result EQUAL 0) + message(FATAL_ERROR "nm failed on ${TARGET} exit(${result}): ${nm_errors}") +endif() + +string(FIND ${out} " T main\n" found) +if(found LESS 0) + message(FATAL_ERROR "Could not find a main() symbol on ${TARGET}") +endif() -- cgit v1.2.1