diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-23 14:37:22 +0100 |
---|---|---|
committer | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-24 21:50:46 +0100 |
commit | 1dff26dd9539feb40767b7761c5339085ad74dbf (patch) | |
tree | 3ada58d729c4146153dfaa70f7f98953ead6e92e /tests/auto/corelib | |
parent | 47435572fbf6ece76a4aee069af04c1ad7fb881c (diff) |
Fix tst_qlibrary after rebuild
tst_qlibrary depends on a library (targets mylib and mylib2) to be
built. They create a library with the same name, in two versions.
This is done in order to test versioned library loading.
However, those two libraries were fighting over the creation of
"libmylib.so". In a fresh build, mylib2 wins, as intended. But after
a rebuild, mylib won, which led to failing unit tests.
This patch changes the situation. With this change, mylib no longer
tries to create "libmylib.so". Thus no fighting and no problem.
Pick-to: 6.0
Change-Id: Id89baa5503c9f078a8737ff0b8616edf09044f72
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt | 31 | ||||
-rw-r--r-- | tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt | 1 |
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt index 4b2e01d997..6bdd30ab17 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt @@ -7,7 +7,7 @@ qt_internal_add_cmake_library(mylib SHARED INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary" - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" + #OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case SOURCES mylib.c PUBLIC_LIBRARIES @@ -27,6 +27,35 @@ if(WIN32) set_property(TARGET mylib PROPERTY PREFIX "") endif() + +if (MACOS) + add_custom_command(TARGET mylib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:mylib> + "${CMAKE_CURRENT_BINARY_DIR}/../" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_BINARY_DIR}/*dylib" + "${CMAKE_CURRENT_BINARY_DIR}/../" + ) +elseif (UNIX) + add_custom_command(TARGET mylib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:mylib> + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1.0.0" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1.0.0" + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1.0.0" + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so1" + ) +else() #Win32 + add_custom_command(TARGET mylib POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:mylib> + "${CMAKE_CURRENT_BINARY_DIR}/../mylib.dll" + ) +endif() # special case end #### Keys ignored in scope 1:.:.:lib.pro:<TRUE>: diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt index f92cec8fb1..e98b4ffa4c 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt @@ -40,7 +40,6 @@ if(WIN32) endif() if (UNIX) - add_dependencies(mylib2 mylib) add_custom_command(TARGET mylib2 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:mylib2> |