summaryrefslogtreecommitdiffstats
path: root/config.tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-02-26 11:41:20 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-03-06 13:38:37 +0100
commitd0911d0a92f47996fcba5520a8a91fe47e10f4a6 (patch)
tree652064c2633931ea62441defc9a29dafd1ef773a /config.tests
parenta3d0ef019a2a592d55035adc784d5d0475f39a74 (diff)
CMake: Port the 'separate_debug_info' feature
For this, we have to uninline the separate_debug_info configure test, because supporting the conversion of this in configurejson2cmake is not worth the hassle. Separate debug information can be turned on for a target by calling the function qt_enable_separate_debug_info. For Qt's shared libraries and tools separate debug information is generated if the 'separate_debug_info' feature is manually turned on. Change-Id: Ic2ffc15efef3794dc0aa42f3d853ef6d651a751c Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'config.tests')
-rw-r--r--config.tests/separate_debug_info/CMakeLists.txt10
-rw-r--r--config.tests/separate_debug_info/main.cpp1
-rw-r--r--config.tests/separate_debug_info/separate_debug_info.pro7
3 files changed, 18 insertions, 0 deletions
diff --git a/config.tests/separate_debug_info/CMakeLists.txt b/config.tests/separate_debug_info/CMakeLists.txt
new file mode 100644
index 0000000000..757374a34a
--- /dev/null
+++ b/config.tests/separate_debug_info/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.14.0)
+project(objcopytest LANGUAGES CXX)
+include(CMakeFindBinUtils)
+add_executable(objcopytest main.cpp)
+add_custom_command(
+ TARGET objcopytest
+ POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $<TARGET_FILE:objcopytest> objcopytest.debug
+ COMMAND ${CMAKE_OBJCOPY} --strip-debug $<TARGET_FILE:objcopytest>
+ COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=objcopytest.debug $<TARGET_FILE:objcopytest>)
diff --git a/config.tests/separate_debug_info/main.cpp b/config.tests/separate_debug_info/main.cpp
new file mode 100644
index 0000000000..237c8ce181
--- /dev/null
+++ b/config.tests/separate_debug_info/main.cpp
@@ -0,0 +1 @@
+int main() {}
diff --git a/config.tests/separate_debug_info/separate_debug_info.pro b/config.tests/separate_debug_info/separate_debug_info.pro
new file mode 100644
index 0000000000..577aa734d6
--- /dev/null
+++ b/config.tests/separate_debug_info/separate_debug_info.pro
@@ -0,0 +1,7 @@
+TARGET = objcopytest
+SOURCES += main.cpp
+load(resolve_target)
+QMAKE_POST_LINK += \
+ $$QMAKE_OBJCOPY --only-keep-debug $$QMAKE_RESOLVED_TARGET objcopytest.debug && \
+ $$QMAKE_OBJCOPY --strip-debug $$QMAKE_RESOLVED_TARGET && \
+ $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopytest.debug $$QMAKE_RESOLVED_TARGET