diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-01-31 11:43:22 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-02-03 15:01:53 +0000 |
commit | 4e7af2061e8c323b2a21f0549643a2cfab191664 (patch) | |
tree | 54c6046915aee4a91eb6178183c022b8e547d244 /tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt | |
parent | 6251963ecd26bfc480b2871e26b6df4d7ab88cee (diff) | |
parent | 3f386095adc6c280008c7e811e88f0215f1d862f (diff) |
Merge remote-tracking branch 'origin/wip/cmake' into dev
This pulls the CMake port, which not only adds CMake files but also
modifies existing code. A brief summary of "seemingly unrelated" changes:
* configure.json was re-formatted to not use multi-line strings. That
is an extension of the Qt JSON parser but not JSON compliant, which
is needed for the configure.json-to-cmake conversion script (python).
* Some moc inclusions were added due to CMake's slightly different way
of handling moc. With the changes the files build with qmake and cmake.
* Since CMake just grep's for the Q_OBJECT macro to determine whether to
call moc (instead of doing pre-processing like qmake), the existing use
of "Q_OBJECT" in our documentation was changed to \Q_OBJECT, which cmake
doesn't see and which is now a qdoc macro.
* QTestLib's qFindTestData was extended to also search in the source
directory known at build time.
What this change also brings is a new way of building modules in Coin by using
YAML configuration files that describe the steps of building and testing in Coin
specific terms. The platform configuration files in qt5 are instructed to use the
old Coin built-in way of testing ("UseLegacyInstructions" feature) but for any
configurations that do not have this, these yaml files in the coin/ sub-directory
are used and shared across repositories.
Change-Id: I1d832c3400e8d6945ad787024ba60e7440225c08
Diffstat (limited to 'tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt')
-rw-r--r-- | tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt | 104 |
1 files changed, 104 insertions, 0 deletions
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)" |