diff options
Diffstat (limited to 'tests/auto/corelib/plugin/qlibrary')
6 files changed, 272 insertions, 0 deletions
diff --git a/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt new file mode 100644 index 0000000000..c0faebc91d --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt @@ -0,0 +1,5 @@ +# Generated from qlibrary.pro. + +add_subdirectory(lib) +add_subdirectory(lib2) +add_subdirectory(tst) diff --git a/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt new file mode 100644 index 0000000000..6dbbd7a060 --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt @@ -0,0 +1,34 @@ +# Generated from lib.pro. + +##################################################################### +## mylib Generic Library: +##################################################################### + +add_cmake_library(mylib + SHARED + INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary" + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" + SOURCES + mylib.c + PUBLIC_LIBRARIES + Qt::Core +) + +#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>: +# INSTALLS = "target" +# TEMPLATE = "lib" +# target.path = "$$[QT_INSTALL_TESTS]/tst_qlibrary" + +## Scopes: +##################################################################### + +extend_target(mylib CONDITION MSVC + DEFINES + WIN32_MSVC +) + +#### Keys ignored in scope 4:.:.:lib.pro:(CMAKE_BUILD_TYPE STREQUAL Debug): +# DESTDIR = "../debug/" + +#### Keys ignored in scope 5:.:.:lib.pro:else: +# DESTDIR = "../release/" diff --git a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt new file mode 100644 index 0000000000..f2de91635a --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt @@ -0,0 +1,43 @@ +# Generated from lib.pro. + +##################################################################### +## mylib Generic Library: +##################################################################### + +add_cmake_library(mylib + SHARED + INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary" + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" + SOURCES + mylib.c + PUBLIC_LIBRARIES + Qt::Core +) + +# special case begin +set_target_properties(mylib PROPERTIES + VERSION 1.0.0 + SOVERSION 1 + C_VISIBILITY_PRESET "default" + CXX_VISIBILITY_PRESET "default" +) +# special case end + +#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>: +# INSTALLS = "target" +# TEMPLATE = "lib" +# target.path = "$$[QT_INSTALL_TESTS]/tst_qlibrary" + +## Scopes: +##################################################################### + +extend_target(mylib CONDITION MSVC + DEFINES + WIN32_MSVC +) + +#### Keys ignored in scope 4:.:.:lib.pro:(CMAKE_BUILD_TYPE STREQUAL Debug): +# DESTDIR = "../debug/" + +#### Keys ignored in scope 5:.:.:lib.pro:else: +# DESTDIR = "../release/" diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt new file mode 100644 index 0000000000..716ad488d0 --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt @@ -0,0 +1,104 @@ +# Generated from lib2.pro. + +##################################################################### +## mylib Generic Library: +##################################################################### + +add_cmake_library(mylib2 # special case + SHARED + INSTALL_DIRECTORY "${INSTALL_TESTSDIR}tst_qlibrary" + #OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case + SOURCES + mylib.c + PUBLIC_LIBRARIES + Qt::Core +) + +# special case begin +# This test is very "annoying" to get working with CMake as it involves having +# two targets with the same name on the parent scope, which is not possible with +# CMake. Furthermore, on UNIX, this version of the library should override the +# root symlink (libmylib.so) to point to version 2. +# Since we can't build two targets with the same name and in the same directory, +# we build mylib2 in it's own directory and manually copy and create the +# symlinks in the parent directory. +# Finally we also need to create a libmylib.so2 file in the parent directory. +# +set_target_properties(mylib2 PROPERTIES + OUTPUT_NAME mylib +) +set_target_properties(mylib2 PROPERTIES + VERSION 2.0.0 + SOVERSION 2 + C_VISIBILITY_PRESET "default" + CXX_VISIBILITY_PRESET "default" +) +if (UNIX) + add_dependencies(mylib2 mylib) + 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" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:mylib2> + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0" + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2" + COMMAND ${CMAKE_COMMAND} -E remove + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0" + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0" + "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2" + ) +else() #Win32 + 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.dll" + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $<TARGET_FILE:mylib2> + "${CMAKE_CURRENT_BINARY_DIR}/../mylib.dl2" + ) +endif() +# special case end + +#### Keys ignored in scope 1:.:.:lib2.pro:<TRUE>: +# INSTALLS = "target" "renamed_target" +# QMAKE_POST_LINK = "$$member(QMAKE_POST_LINK, 0, -2)" +# TEMPLATE = "lib" +# VERSION = "2" +# renamed_target.extra = "$$member(renamed_target.extra, 0, -2)" +# renamed_target.path = "$$target.path" +# target.path = "$$[QT_INSTALL_TESTS]$${QMAKE_DIR_SEP}tst_qlibrary" + +## Scopes: +##################################################################### + +extend_target(mylib2 CONDITION MSVC # special case + DEFINES + WIN32_MSVC +) + +#### Keys ignored in scope 3:.:.:lib2.pro:WIN32: +# DESTDIR = "../$$BUILD_FOLDER/" +# files = "$$BUILD_FOLDER$${QMAKE_DIR_SEP}mylib.dl2" "$$BUILD_FOLDER$${QMAKE_DIR_SEP}system.qt.test.mylib.dll" + +#### Keys ignored in scope 4:.:.:lib2.pro:(CMAKE_BUILD_TYPE STREQUAL Debug): +# BUILD_FOLDER = "debug" + +#### Keys ignored in scope 5:.:.:lib2.pro:else: +# BUILD_FOLDER = "release" + +#### Keys ignored in scope 6:.:.:lib2.pro:TEMPLATE___contains___vc._x_: +# src = "$(TargetPath)" + +#### Keys ignored in scope 7:.:.:lib2.pro:else: +# src = "$(DESTDIR_TARGET)" + +#### Keys ignored in scope 8:.:.:lib2.pro:else: +# files = "libmylib.so2" "system.qt.test.mylib.so" +# src = "$(DESTDIR)$(TARGET)" diff --git a/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt new file mode 100644 index 0000000000..250521a8d4 --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from tst.pro. + +##################################################################### +## tst_qlibrary Test: +##################################################################### + +# Collect test data +list(APPEND test_data "../library_path/invalid.so") + +add_qt_test(tst_qlibrary + SOURCES + ../tst_qlibrary.cpp + TESTDATA ${test_data} +) + +## Scopes: +##################################################################### + +if(ANDROID) + # Resources: + set(qmake_libs_resource_files + ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.prl + ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so + ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2 + ${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so + ) + + add_qt_resource(tst_qlibrary "qmake_libs" + PREFIX + "android_test_data" + BASE + "${CMAKE_CURRENT_BINARY_DIR}/.." + FILES + ${qmake_libs_resource_files} + ) +endif() diff --git a/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt new file mode 100644 index 0000000000..d041238bc8 --- /dev/null +++ b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt @@ -0,0 +1,50 @@ +# Generated from tst.pro. + +##################################################################### +## tst_qlibrary Test: +##################################################################### + +# Collect test data +list(APPEND test_data "../library_path/invalid.so") + +add_qt_test(tst_qlibrary + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case + SOURCES + ../tst_qlibrary.cpp + TESTDATA ${test_data} +) + +## Scopes: +##################################################################### + +if(ANDROID) + # special case begin + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so + PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY mylib + ) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2 + ${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so + PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY mylib2 + ) + # special case end + # Resources: + set(qmake_libs_resource_files + # special case begin + #libmylib.prl + libmylib.so + libmylib.so2 + system.qt.test.mylib.so + # special case end + ) + + add_qt_resource(tst_qlibrary "qmake_libs" + PREFIX + "android_test_data" + BASE + "${CMAKE_CURRENT_BINARY_DIR}/.." + FILES + ${qmake_libs_resource_files} + ) +endif() |