CMake: Fix tst_qlibrary to work on macOS with debug builds
The test expects the helper libraries to contain the .dylib suffix rather than .so. Replace glob copying of the libraries (which depends on the underlying shell) with manual copy calls. This also ensures the libraries don't contain a _debug postfix in the file name even in a debug build, which would break the tests. Amendsf8c1909320
Amends1dff26dd95
Change-Id: I20361c33c4a1b9dd4b5273fcdb8cc79c9f266327 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
d86ab16a86
commit
cd4a3a1dc7
@ -30,27 +30,27 @@ 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)
|
||||
if (NOT ANDROID)
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
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"
|
||||
$<TARGET_FILE:mylib>
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.1.0.0.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"libmylib.so.1.0.0"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1"
|
||||
"libmylib.1.0.0.dylib"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.1.dylib"
|
||||
VERBATIM)
|
||||
elseif(NOT ANDROID)
|
||||
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
|
||||
"libmylib.so.1.0.0"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so1"
|
||||
"libmylib.so.1.0.0"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"libmylib.so.1.0.0"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so1"
|
||||
VERBATIM)
|
||||
else()
|
||||
# Android does not use symlinks. Also, according to our conventions,
|
||||
@ -64,10 +64,10 @@ elseif (UNIX)
|
||||
endif()
|
||||
else() #Win32
|
||||
add_custom_command(TARGET mylib POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:mylib>
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../mylib.dll"
|
||||
VERBATIM)
|
||||
VERBATIM)
|
||||
endif()
|
||||
# special case end
|
||||
|
||||
|
@ -42,8 +42,28 @@ if(WIN32)
|
||||
set_property(TARGET mylib2 PROPERTY PREFIX "")
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
if(NOT ANDROID)
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
add_custom_command(TARGET mylib2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:mylib2>
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:mylib2>
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.2.0.0.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"libmylib.2.0.0.dylib"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.2.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"libmylib.2.0.0.dylib"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.dylib"
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
"libmylib.2.0.0.dylib"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2.dylib"
|
||||
VERBATIM)
|
||||
elseif(NOT ANDROID)
|
||||
add_custom_command(TARGET mylib2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:mylib2>
|
||||
|
Loading…
Reference in New Issue
Block a user