diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-02-24 14:12:46 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-02-25 15:43:15 +0100 |
commit | 8ab59fd8b358f6aee94b5b2907209170b28acaca (patch) | |
tree | 6aaa1e9c8ab65d8cc02f642f9a0ede01f6277422 | |
parent | ae9f0aa86aba649f2cbde832d5519b7804fd5c0c (diff) |
CMake: Fix 3rd party library installation
Libraries created with qt_add_3rdparty_library should be installed
when the qmake 'installed' value is set in CONFIG. Introduce a new
INSTALL option to handle that in CMake projects.
If the value is provided, the library should always be installed
regardless of whether it's a shared or static library.
Fix the libraries to be installed to BINDIR/LIBDIR instead of
the config install dir.
Also install the CMake config files into the config install dir.
Change-Id: I86f1ef47680f08669a77db77e0d986f47d5fae2d
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | cmake/QtBuild.cmake | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 7941bcbe16..48c38f3d8a 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -2969,7 +2969,7 @@ endfunction() function(qt_add_3rdparty_library target) # Process arguments: qt_parse_all_arguments(arg "qt_add_3rdparty_library" - "SHARED;MODULE;STATIC;INTERFACE;EXCEPTIONS" + "SHARED;MODULE;STATIC;INTERFACE;EXCEPTIONS;INSTALL" "OUTPUT_DIRECTORY" "${__default_private_args};${__default_public_args}" ${ARGN} @@ -3062,7 +3062,7 @@ function(qt_add_3rdparty_library target) ${install_arguments} ) - if(NOT BUILD_SHARED_LIBS OR arg_SHARED) + if(NOT BUILD_SHARED_LIBS OR arg_INSTALL) set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target}") qt_path_join(config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix}) qt_path_join(config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix}) @@ -3080,9 +3080,18 @@ function(qt_add_3rdparty_library target) COMPATIBILITY AnyNewerVersion ) + qt_install(FILES + "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake" + "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersion.cmake" + DESTINATION "${config_install_dir}" + COMPONENT Devel + ) + qt_install(TARGETS ${target} EXPORT "${export_name}" - DESTINATION "${config_install_dir}" + RUNTIME DESTINATION ${INSTALL_BINDIR} + LIBRARY DESTINATION ${INSTALL_LIBDIR} + ARCHIVE DESTINATION ${INSTALL_LIBDIR} ) qt_install(EXPORT ${export_name} |