aboutsummaryrefslogtreecommitdiff
path: root/toolchain/hasMainSymbol.cmake
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2018-04-11 20:20:19 +0200
committerAleix Pol <aleixpol@kde.org>2018-04-12 11:47:02 +0200
commit8e2ce83987d26077d28bd26342100683ea35d2f1 (patch)
tree5a76ffd9e9f1aa2544aa4738241ba58aa99534f1 /toolchain/hasMainSymbol.cmake
parent4baac2ecae1f23723d4fde4f346bdaa54112d9a2 (diff)
downloadextra-cmake-modules-8e2ce83987d26077d28bd26342100683ea35d2f1.tar.gz
extra-cmake-modules-8e2ce83987d26077d28bd26342100683ea35d2f1.tar.bz2
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
Diffstat (limited to 'toolchain/hasMainSymbol.cmake')
-rw-r--r--toolchain/hasMainSymbol.cmake10
1 files changed, 10 insertions, 0 deletions
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()