summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Android/check_binary.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-03 15:31:59 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-03 18:34:57 (GMT)
commit843d55de295b0eeca2a028badde3b2f9a409cc72 (patch)
tree3ef22b1de380da49007e6fd5eb7684f51386868a /Tests/RunCMake/Android/check_binary.cmake
parent12e6796b6289dbc910b9b7fe57f6b564edbc46dd (diff)
downloadCMake-843d55de295b0eeca2a028badde3b2f9a409cc72.zip
CMake-843d55de295b0eeca2a028badde3b2f9a409cc72.tar.gz
CMake-843d55de295b0eeca2a028badde3b2f9a409cc72.tar.bz2
Android: Suppress implicit -lstdc++ linker flag
The chosen STL libraries are already linked explicitly so we shouldn't let the compiler add its implicit `-lstdc++` (the default) when invoking the linker. Fixes: #17863 NDK-Issue: https://github.com/android-ndk/ndk/issues/105 Inspired-by: Tom Hughes <tomtheengineer@gmail.com>
Diffstat (limited to 'Tests/RunCMake/Android/check_binary.cmake')
-rw-r--r--Tests/RunCMake/Android/check_binary.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/Tests/RunCMake/Android/check_binary.cmake b/Tests/RunCMake/Android/check_binary.cmake
new file mode 100644
index 0000000..1d1b01a
--- /dev/null
+++ b/Tests/RunCMake/Android/check_binary.cmake
@@ -0,0 +1,8 @@
+if(NOT EXISTS "${file}")
+ message(FATAL_ERROR "Missing file:\n ${file}")
+endif()
+execute_process(COMMAND "${objdump}" -p ${file} OUTPUT_VARIABLE out)
+if(out MATCHES "NEEDED[^\n]*stdc\\+\\+")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "File:\n ${file}\ndepends on libstdc++:\n${out}")
+endif()