2018-10-24 13:20:27 +00:00
include ( CMakePackageConfigHelpers )
# Install locations:
2019-09-24 12:27:09 +00:00
set ( INSTALL_BINDIR "bin" CACHE STRING "Executables [PREFIX/bin]" )
set ( INSTALL_INCLUDEDIR "include" CACHE STRING "Header files [PREFIX/include]" )
set ( INSTALL_LIBDIR "lib" CACHE STRING "Libraries [PREFIX/lib]" )
2020-01-15 22:01:16 +00:00
set ( INSTALL_MKSPECSDIR "mkspecs" CACHE STRING "Mkspecs files [PREFIX/mkspecs]" )
2019-09-24 12:27:09 +00:00
set ( INSTALL_ARCHDATADIR "." CACHE STRING "Arch-dependent data [PREFIX]" )
set ( INSTALL_PLUGINSDIR "${INSTALL_ARCHDATADIR}/plugins" CACHE STRING
2018-10-24 13:20:27 +00:00
" P l u g i n s [ A R C H D A T A D I R / p l u g i n s ] " )
set ( INSTALL_TARGETS_DEFAULT_ARGS
R U N T I M E D E S T I N A T I O N " $ { I N S T A L L _ B I N D I R } "
L I B R A R Y D E S T I N A T I O N " $ { I N S T A L L _ L I B D I R } "
A R C H I V E D E S T I N A T I O N " $ { I N S T A L L _ L I B D I R } " C O M P O N E N T D e v e l
I N C L U D E S D E S T I N A T I O N " $ { I N S T A L L _ I N C L U D E D I R } "
)
if ( WIN32 )
set ( _default_libexec "${INSTALL_ARCHDATADIR}/bin" )
else ( )
set ( _default_libexec "${INSTALL_ARCHDATADIR}/libexec" )
endif ( )
2019-09-24 12:27:09 +00:00
set ( INSTALL_LIBEXECDIR "${_default_libexec}" CACHE STRING
2018-10-24 13:20:27 +00:00
" H e l p e r p r o g r a m s [ A R C H D A T A D I R / b i n o n W i n d o w s , A R C H D A T A D I R / l i b e x e c o t h e r w i s e ] " )
2019-09-24 12:27:09 +00:00
set ( INSTALL_QMLDIR "${INSTALL_ARCHDATADIR}/qml" CACHE STRING
2018-10-24 13:20:27 +00:00
" Q M L 2 i m p o r t s [ A R C H D A T A D I R / q m l ] " )
2019-09-24 12:27:09 +00:00
set ( INSTALL_DATADIR "." CACHE STRING "Arch-independent data [PREFIX]" )
set ( INSTALL_DOCDIR "${INSTALL_DATADIR}/doc" CACHE STRING "Documentation [DATADIR/doc]" )
set ( INSTALL_TRANSLATIONSDIR "${INSTALL_DATADIR}/translations" CACHE STRING
2018-10-24 13:20:27 +00:00
" T r a n s l a t i o n s [ D A T A D I R / t r a n s l a t i o n s ] " )
2019-09-24 12:27:09 +00:00
set ( INSTALL_SYSCONFDIR "etc/xdg" CACHE STRING
2018-10-24 13:20:27 +00:00
" S e t t i n g s u s e d b y Q t p r o g r a m s [ P R E F I X / e t c / x d g ] " )
2019-09-24 12:27:09 +00:00
set ( INSTALL_EXAMPLESDIR "examples" CACHE STRING "Examples [PREFIX/examples]" )
set ( INSTALL_TESTSDIR "tests" CACHE STRING "Tests [PREFIX/tests]" )
set ( INSTALL_DESCRIPTIONSDIR "${INSTALL_DATADIR}/modules" CACHE STRING
" M o d u l e d e s c r i p t i o n f i l e s d i r e c t o r y " )
2018-10-24 13:20:27 +00:00
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
# The variables might have already been set in QtBuildInternalsExtra.cmake if the file is included
# while building a new module and not QtBase. In that case, stop overriding the value.
if ( NOT INSTALL_CMAKE_NAMESPACE )
set ( INSTALL_CMAKE_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
C A C H E S T R I N G " C M a k e n a m e s p a c e [ Q t $ { P R O J E C T _ V E R S I O N _ M A J O R } ] " )
endif ( )
if ( NOT QT_CMAKE_EXPORT_NAMESPACE )
set ( QT_CMAKE_EXPORT_NAMESPACE "Qt${PROJECT_VERSION_MAJOR}"
C A C H E S T R I N G " C M a k e n a m e s p a c e u s e d w h e n e x p o r t i n g t a r g e t s [ Q t $ { P R O J E C T _ V E R S I O N _ M A J O R } ] " )
endif ( )
2019-02-11 10:34:35 +00:00
2019-02-13 08:45:18 +00:00
set ( QT_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}" )
2019-02-12 09:02:15 +00:00
2019-11-21 12:33:28 +00:00
# Find the path to mkspecs/, depending on whether we are building as part of a standard qtbuild,
# or a module against an already installed version of qt.
if ( NOT QT_MKSPECS_DIR )
if ( "${QT_BUILD_INTERNALS_PATH}" STREQUAL "" )
get_filename_component ( QT_MKSPECS_DIR "${CMAKE_CURRENT_LIST_DIR}/../mkspecs" ABSOLUTE )
else ( )
# We can rely on CMAKE_INSTALL_PREFIX being set by QtBuildInternalsExtra.cmake
2020-01-15 22:01:16 +00:00
get_filename_component ( QT_MKSPECS_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_MKSPECSDIR}" ABSOLUTE )
2019-11-21 12:33:28 +00:00
endif ( )
set ( QT_MKSPECS_DIR "${QT_MKSPECS_DIR}" CACHE INTERNAL "" )
endif ( )
2019-02-11 14:45:56 +00:00
# the default RPATH to be used when installing, but only if it's not a system directory
2020-01-21 14:38:27 +00:00
LIST ( FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}" isSystemDir )
2019-02-11 14:45:56 +00:00
IF ( "${isSystemDir}" STREQUAL "-1" )
2020-01-21 14:38:27 +00:00
SET ( _default_install_rpath "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}" )
2019-02-11 14:45:56 +00:00
ENDIF ( "${isSystemDir}" STREQUAL "-1" )
# Default rpath settings: Use rpath for build tree as well as a full path for the installed binaries.
# For origin builds, one needs to override CMAKE_INSTALL_RPATH for example with $ORIGIN/../lib
SET ( CMAKE_INSTALL_RPATH "${_default_install_rpath}" CACHE PATH "RPATH for installed binaries" )
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
2019-09-24 09:42:15 +00:00
# Generate a module description file based on the template in ModuleDescription.json.in
function ( qt_describe_module target )
set ( path_suffix "${INSTALL_DESCRIPTIONSDIR}" )
qt_path_join ( build_dir ${ QT_BUILD_DIR } ${ path_suffix } )
qt_path_join ( install_dir ${ QT_INSTALL_DIR } ${ path_suffix } )
set ( descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in" )
set ( descfile_out "${build_dir}/${target}.json" )
set ( cross_compilation "false" )
if ( CMAKE_CROSSCOMPILE )
set ( cross_compilation "true" )
endif ( )
configure_file ( "${descfile_in}" "${descfile_out}" )
qt_install ( FILES "${descfile_out}" DESTINATION "${install_dir}" )
endfunction ( )
2019-09-04 08:52:18 +00:00
function ( qt_setup_tool_path_command )
if ( NOT WIN32 )
return ( )
endif ( )
set ( bindir "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
file ( TO_NATIVE_PATH "${bindir}" bindir )
2019-09-04 13:47:11 +00:00
list ( APPEND command COMMAND )
2019-09-26 11:31:19 +00:00
list ( APPEND command set PATH= ${ bindir } $< SEMICOLON > %PATH% )
2019-09-04 08:52:18 +00:00
set ( QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE )
endfunction ( )
qt_setup_tool_path_command ( )
2018-10-24 13:20:27 +00:00
# Platform define path, etc.
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC "" )
2018-10-24 13:20:27 +00:00
if ( WIN32 )
set ( QT_DEFAULT_PLATFORM_DEFINITIONS UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE )
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
list ( APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64 )
endif ( )
if ( MSVC )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC win32-msvc )
2019-11-22 16:11:22 +00:00
elseif ( CLANG AND MINGW )
set ( QT_QMAKE_TARGET_MKSPEC win32-clang-g++ )
2019-05-03 13:46:02 +00:00
elseif ( MINGW )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC win32-g++ )
2019-11-22 16:11:22 +00:00
endif ( )
if ( MINGW )
2019-05-03 13:46:02 +00:00
list ( APPEND QT_DEFAULT_PLATFORM_DEFINITIONS _WIN32_WINNT=0x0601 )
2018-10-24 13:20:27 +00:00
endif ( )
elseif ( LINUX )
if ( GCC )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC linux-g++ )
2018-10-24 13:20:27 +00:00
elseif ( CLANG )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC linux-clang )
2019-06-17 10:13:48 +00:00
elseif ( ICC )
set ( QT_QMAKE_TARGET_MKSPEC linux-icc-64 )
2018-10-24 13:20:27 +00:00
endif ( )
2019-05-29 14:22:38 +00:00
elseif ( ANDROID )
if ( GCC )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC android-g++ )
2019-05-29 14:22:38 +00:00
elseif ( CLANG )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC android-clang )
2019-05-29 14:22:38 +00:00
endif ( )
2018-10-24 13:20:27 +00:00
elseif ( APPLE )
2019-05-31 14:30:09 +00:00
set ( QT_QMAKE_TARGET_MKSPEC macx-clang )
2019-08-28 13:59:11 +00:00
elseif ( EMSCRIPTEN )
set ( QT_QMAKE_TARGET_MKSPEC wasm-emscripten )
2019-05-31 14:30:09 +00:00
endif ( )
# TODO: Fixme to be correct.
set ( QT_QMAKE_HOST_MKSPEC "${QT_QMAKE_TARGET_MKSPEC}" )
2020-01-15 22:01:16 +00:00
# Platform definition dir provided by user on command line.
# Derive the absolute one relative to the current source dir.
if ( QT_PLATFORM_DEFINITION_DIR )
set ( QT_DEFAULT_PLATFORM_DEFINITION_DIR "${QT_PLATFORM_DEFINITION_DIR}" )
get_filename_component (
Q T _ D E F A U L T _ P L A T F O R M _ D E F I N I T I O N _ D I R _ A B S O L U T E
" $ { Q T _ P L A T F O R M _ D E F I N I T I O N _ D I R } "
A B S O L U T E )
elseif ( QT_QMAKE_TARGET_MKSPEC )
# Used by consumers of prefix builds via INSTALL_INTERFACE (relative path).
set ( QT_DEFAULT_PLATFORM_DEFINITION_DIR "${INSTALL_MKSPECSDIR}/${QT_QMAKE_TARGET_MKSPEC}" )
# Used by qtbase itself and consumers of non-prefix builds via BUILD_INTERFACE (absolute path).
set ( QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE "${QT_MKSPECS_DIR}/${QT_QMAKE_TARGET_MKSPEC}" )
2018-10-24 13:20:27 +00:00
endif ( )
if ( NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS )
set ( QT_DEFAULT_PLATFORM_DEFINITIONS "" )
endif ( )
set ( QT_PLATFORM_DEFINITIONS ${ QT_DEFAULT_PLATFORM_DEFINITIONS }
C A C H E S T R I N G " Q t p l a t f o r m s p e c i f i c p r e - p r o c e s s o r d e f i n e s " )
2020-01-15 22:01:16 +00:00
set ( QT_PLATFORM_DEFINITION_DIR "${QT_DEFAULT_PLATFORM_DEFINITION_DIR}"
2018-10-24 13:20:27 +00:00
C A C H E P A T H " P a t h t o d i r e c t o r y t h a t c o n t a i n s q p l a t f o r m d e f s . h " )
2020-01-15 22:01:16 +00:00
set ( QT_PLATFORM_DEFINITION_DIR_ABSOLUTE "${QT_DEFAULT_PLATFORM_DEFINITION_DIR_ABSOLUTE}"
C A C H E I N T E R N A L " P a t h t o d i r e c t o r y t h a t c o n t a i n s q p l a t f o r m d e f s . h " )
2018-10-24 13:20:27 +00:00
set ( QT_NAMESPACE "" CACHE STRING "Qt Namespace" )
2019-01-30 15:31:06 +00:00
if ( QT_NAMESPACE STREQUAL "" )
set ( QT_HAS_NAMESPACE OFF )
else ( )
set ( QT_HAS_NAMESPACE ON )
endif ( )
2018-10-24 13:20:27 +00:00
2019-08-20 13:24:14 +00:00
function ( qt_internal_clear_qt_repo_known_modules )
set ( QT_REPO_KNOWN_MODULES "" CACHE INTERNAL "Known current repo Qt modules" FORCE )
endfunction ( )
function ( qt_internal_add_qt_repo_known_module )
set ( QT_REPO_KNOWN_MODULES ${ QT_REPO_KNOWN_MODULES } ${ ARGN }
C A C H E I N T E R N A L " K n o w n c u r r e n t r e p o Q t m o d u l e s " F O R C E )
endfunction ( )
function ( qt_internal_get_qt_repo_known_modules out_var )
set ( "${out_var}" "${QT_REPO_KNOWN_MODULES}" PARENT_SCOPE )
endfunction ( )
# Gets the list of all known Qt modules both found and that were built as part of the
# current project.
function ( qt_internal_get_qt_all_known_modules out_var )
qt_internal_get_qt_repo_known_modules ( repo_known_modules )
set ( known_modules ${ QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE } ${ repo_known_modules } )
list ( REMOVE_DUPLICATES known_modules )
set ( "${out_var}" "${known_modules}" PARENT_SCOPE )
endfunction ( )
2019-05-03 14:03:15 +00:00
macro ( qt_internal_set_qt_known_plugins )
set ( QT_KNOWN_PLUGINS ${ ARGN } CACHE INTERNAL "Known Qt plugins" FORCE )
endmacro ( )
2018-10-24 13:20:27 +00:00
2019-09-23 14:57:06 +00:00
### Global plug-in types handling ###
# QT_REPO_KNOWN_PLUGIN_TYPES and QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE
# hold a list of plug-in types (e.G. "imageformats;bearer")
function ( qt_internal_clear_qt_repo_known_plugin_types )
set ( QT_REPO_KNOWN_PLUGIN_TYPES "" CACHE INTERNAL "Known current repo Qt plug-in types" FORCE )
endfunction ( )
function ( qt_internal_add_qt_repo_known_plugin_types )
set ( QT_REPO_KNOWN_PLUGIN_TYPES ${ QT_REPO_KNOWN_PLUGIN_TYPES } ${ ARGN }
C A C H E I N T E R N A L " K n o w n c u r r e n t r e p o Q t p l u g - i n t y p e s " F O R C E )
endfunction ( )
function ( qt_internal_get_qt_repo_known_plugin_types out_var )
set ( "${out_var}" "${QT_REPO_KNOWN_PLUGIN_TYPES}" PARENT_SCOPE )
endfunction ( )
function ( qt_internal_get_qt_all_known_plugin_types out_var )
qt_internal_get_qt_repo_known_plugin_types ( repo_known_plugin_types )
set ( known ${ QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE } ${ repo_known_plugin_types } )
list ( REMOVE_DUPLICATES known )
set ( "${out_var}" "${known}" PARENT_SCOPE )
endfunction ( )
2018-11-08 21:29:54 +00:00
# Reset:
2019-09-23 14:57:06 +00:00
qt_internal_clear_qt_repo_known_modules ( )
qt_internal_clear_qt_repo_known_plugin_types ( )
2019-05-03 14:03:15 +00:00
qt_internal_set_qt_known_plugins ( "" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
set ( QT_KNOWN_MODULES_WITH_TOOLS "" CACHE INTERNAL "Known Qt modules with tools" FORCE )
macro ( qt_internal_append_known_modules_with_tools module )
if ( NOT ${ module } IN_LIST QT_KNOWN_MODULES_WITH_TOOLS )
set ( QT_KNOWN_MODULES_WITH_TOOLS "${QT_KNOWN_MODULES_WITH_TOOLS};${module}"
C A C H E I N T E R N A L " K n o w n Q t m o d u l e s w i t h t o o l s " F O R C E )
2019-12-05 14:47:24 +00:00
set ( QT_KNOWN_MODULE_ ${ module } _TOOLS ""
C A C H E I N T E R N A L " K n o w n Q t m o d u l e $ { m o d u l e } t o o l s " F O R C E )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
endif ( )
endmacro ( )
macro ( qt_internal_append_known_module_tool module tool )
if ( NOT ${ tool } IN_LIST QT_KNOWN_MODULE_ ${ module } _TOOLS )
list ( APPEND QT_KNOWN_MODULE_ ${ module } _TOOLS "${tool}" )
set ( QT_KNOWN_MODULE_ ${ module } _TOOLS "${QT_KNOWN_MODULE_${module}_TOOLS}"
C A C H E I N T E R N A L " K n o w n Q t m o d u l e $ { m o d u l e } t o o l s " F O R C E )
endif ( )
endmacro ( )
# Reset syncqt cache variable, to make sure it gets recomputed on reconfiguration, otherwise
# it might not get installed.
unset ( QT_SYNCQT CACHE )
2018-10-24 13:20:27 +00:00
# For adjusting variables when running tests, we need to know what
# the correct variable is for separating entries in PATH-alike
# variables.
if ( CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" )
set ( QT_PATH_SEPARATOR "\\;" )
else ( )
set ( QT_PATH_SEPARATOR ":" )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
# Compute the values of QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR
2019-11-21 12:33:28 +00:00
# taking into account whether the current build is a prefix build or a non-prefix build,
# and whether it is a superbuild or non-superbuild.
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
#
# These values should be prepended to file paths in commands or properties,
# in order to correctly place generated Config files, generated Targets files,
# excutables / libraries, when copying / installing files, etc.
#
# The build dir variables will always be absolute paths.
# The QT_INSTALL_DIR variable will have a relative path in a prefix build,
# which means that it can be empty, so use qt_join_path to prevent accidental absolute paths.
2019-11-21 12:33:28 +00:00
if ( QT_SUPERBUILD )
# In this case, we always copy all the build products in qtbase/{bin,lib,...}
if ( QT_WILL_INSTALL )
set ( QT_BUILD_DIR "${QtBase_BINARY_DIR}" )
set ( QT_INSTALL_DIR "" )
else ( )
set ( QT_BUILD_DIR "${QtBase_BINARY_DIR}" )
set ( QT_INSTALL_DIR "${QtBase_BINARY_DIR}" )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
else ( )
2019-11-21 12:33:28 +00:00
if ( QT_WILL_INSTALL )
# In the usual prefix build case, the build dir is the current module build dir,
# and the install dir is the prefix, so we don't set it.
set ( QT_BUILD_DIR "${CMAKE_BINARY_DIR}" )
set ( QT_INSTALL_DIR "" )
else ( )
# When doing a non-prefix build, both the build dir and install dir are the same,
# pointing to the qtbase build dir.
set ( QT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" )
set ( QT_INSTALL_DIR "${QT_BUILD_DIR}" )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
endif ( )
2019-11-21 12:33:28 +00:00
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( __config_path_part "${INSTALL_LIBDIR}/cmake" )
set ( QT_CONFIG_BUILD_DIR "${QT_BUILD_DIR}/${__config_path_part}" )
set ( QT_CONFIG_INSTALL_DIR "${QT_INSTALL_DIR}" )
if ( QT_CONFIG_INSTALL_DIR )
string ( APPEND QT_CONFIG_INSTALL_DIR "/" )
endif ( )
string ( APPEND QT_CONFIG_INSTALL_DIR ${ __config_path_part } )
unset ( __config_path_part )
2018-10-24 13:20:27 +00:00
2019-05-15 11:57:15 +00:00
# This is used to hold extra cmake code that should be put into QtBuildInternalsExtra.cmake file
# at the QtPostProcess stage.
set ( QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "" )
2019-07-26 16:15:41 +00:00
# Save the value of the current first project source dir.
# This will be /path/to/qtbase for qtbase both in a super-build and a non super-build.
# This will be /path/to/qtbase/tests when building standalone tests.
set ( QT_TOP_LEVEL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" )
2019-09-23 11:35:06 +00:00
# Prevent warnings about object files without any symbols. This is a common
# thing in Qt as we tend to build files unconditionally, and then use ifdefs
# to compile out parts that are not relevant.
if ( CMAKE_HOST_APPLE AND APPLE )
foreach ( lang ASM C CXX )
# We have to tell 'ar' to not run ranlib by itself, by passing the 'S' option
set ( CMAKE_ ${ lang } _ARCHIVE_CREATE "<CMAKE_AR> qcS <TARGET> <LINK_FLAGS> <OBJECTS>" )
set ( CMAKE_ ${ lang } _ARCHIVE_APPEND "<CMAKE_AR> qS <TARGET> <LINK_FLAGS> <OBJECTS>" )
set ( CMAKE_ ${ lang } _ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols <TARGET>" )
endforeach ( )
endif ( )
2018-10-24 13:20:27 +00:00
# Functions and macros:
2019-07-18 07:38:37 +00:00
# qt_remove_args can remove arguments from an existing list of function
# arguments in order to pass a filtered list of arguments to a different function.
# Parameters:
# out_var: result of remove all arguments specified by ARGS_TO_REMOVE from ALL_ARGS
# ARGS_TO_REMOVE: Arguments to remove.
# ALL_ARGS: All arguments supplied to cmake_parse_arguments or
# qt_parse_all_arguments
# from which ARGS_TO_REMOVE should be removed from. We require all the
# arguments or we can't properly identify the range of the arguments detailed
# in ARGS_TO_REMOVE.
# ARGS: Arguments passed into the function, usually ${ARGV}
#
# E.g.:
# We want to forward all arguments from foo to bar, execpt ZZZ since it will
# trigger an error in bar.
#
# foo(target BAR .... ZZZ .... WWW ...)
# bar(target BAR.... WWW...)
#
# function(foo target)
# qt_parse_all_arguments(arg "" "" "BAR;ZZZ;WWW ${ARGV})
# qt_remove_args(forward_args
# ARGS_TO_REMOVE ${target} ZZZ
# ALL_ARGS ${target} BAR ZZZ WWW
# ARGS ${ARGV}
# )
# bar(${target} ${forward_args})
# endfunction()
#
function ( qt_remove_args out_var )
cmake_parse_arguments ( arg "" "" "ARGS_TO_REMOVE;ALL_ARGS;ARGS" ${ ARGN } )
set ( result ${ arg_ARGS } )
foreach ( arg IN LISTS arg_ARGS_TO_REMOVE )
# find arg
list ( FIND result ${ arg } find_result )
if ( NOT find_result EQUAL -1 )
# remove arg
list ( REMOVE_AT result ${ find_result } )
list ( LENGTH result result_len )
list ( GET result ${ find_result } arg_current )
# remove values until we hit another arg
while ( NOT ${ arg_current } IN_LIST arg_ALL_ARGS AND find_result LESS result_len )
list ( REMOVE_AT result ${ find_result } )
list ( GET result ${ find_result } arg_current )
list ( LENGTH result result_len )
endwhile ( )
endif ( )
endforeach ( )
set ( ${ out_var } "${result}" PARENT_SCOPE )
endfunction ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
# Wraps install() command. In a prefix build, simply passes along arguments to install().
# In a non-prefix build, handles association of targets to export names, and also calls export().
function ( qt_install )
set ( flags )
set ( options EXPORT DESTINATION NAMESPACE )
set ( multiopts TARGETS )
cmake_parse_arguments ( arg "${flags}" "${options}" "${multiopts}" ${ ARGN } )
if ( arg_TARGETS )
set ( is_install_targets TRUE )
endif ( )
# In a prefix build, always invoke install() without modification.
# In a non-prefix build, pass install(TARGETS) commands to allow
# association of targets to export names, so we can later use the export names
# in export() commands.
if ( QT_WILL_INSTALL OR is_install_targets )
install ( ${ ARGV } )
endif ( )
# Exit early if this is a prefix build.
if ( QT_WILL_INSTALL )
return ( )
endif ( )
# In a non-prefix build, when install(EXPORT) is called,
# also call export(EXPORT) to generate build tree target files.
if ( NOT is_install_targets AND arg_EXPORT )
set ( namespace_option "" )
if ( arg_NAMESPACE )
set ( namespace_option NAMESPACE ${ arg_NAMESPACE } )
endif ( )
export ( EXPORT ${ arg_EXPORT }
$ { n a m e s p a c e _ o p t i o n }
F I L E " $ { a r g _ D E S T I N A T I O N } / $ { a r g _ E X P O R T } . c m a k e " )
endif ( )
endfunction ( )
# Copies files using file(COPY) signature in non-prefix builds.
function ( qt_non_prefix_copy )
if ( NOT QT_WILL_INSTALL )
file ( ${ ARGV } )
endif ( )
endfunction ( )
# Use case is installing files in a prefix build, or copying them to the correct build dir
# in a non-prefix build.
# Pass along arguments as you would pass them to install().
# Only supports FILES, PROGRAMS and DIRECTORY signature, and without fancy things
# like OPTIONAL or RENAME or COMPONENT.
function ( qt_copy_or_install )
set ( flags FILES PROGRAMS DIRECTORY )
set ( options )
set ( multiopts )
cmake_parse_arguments ( arg "${flags}" "${options}" "${multiopts}" ${ ARGN } )
# Remember which option has to be passed to the install command.
set ( argv_copy ${ ARGV } )
if ( arg_FILES )
set ( install_option "FILES" )
elseif ( arg_PROGRAMS )
set ( install_option "PROGRAMS" )
elseif ( arg_DIRECTORY )
set ( install_option "DIRECTORY" )
endif ( )
list ( REMOVE_AT argv_copy 0 )
qt_install ( ${ install_option } ${ argv_copy } )
qt_non_prefix_copy ( COPY ${ argv_copy } )
endfunction ( )
# Hacky way to remove the install target in non-prefix builds.
# We need to associate targets with export names, and that is only possible to do with the
# install(TARGETS) command. But in a non-prefix build, we don't want to install anything.
# To make sure that developers don't accidentally run make install, replace the generated
# cmake_install.cmake file with an empty file. To do this, always create a new temporary file
# at CMake configuration step, and use it as an input to a custom command that replaces the
# cmake_install.cmake file with an empty one. This means we will always replace the file on
# every reconfiguration, but not when doing null builds.
2019-11-13 13:03:20 +00:00
function ( qt_remove_install_target )
2019-11-21 12:33:28 +00:00
# On superbuilds we only do this for qtbase - it will correctly remove the
# cmake_install.cmake at the root of the repository.
if ( QT_SUPERBUILD )
if ( NOT ( PROJECT_NAME STREQUAL "QtBase" ) )
return ( )
endif ( )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( file_in "${CMAKE_BINARY_DIR}/.remove_cmake_install_in.txt" )
set ( file_generated "${CMAKE_BINARY_DIR}/.remove_cmake_install_generated.txt" )
set ( cmake_install_file "${CMAKE_BINARY_DIR}/cmake_install.cmake" )
file ( WRITE ${ file_in } "" )
add_custom_command ( OUTPUT ${ file_generated }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y $ { f i l e _ i n } $ { f i l e _ g e n e r a t e d }
C O M M A N D $ { C M A K E _ C O M M A N D } - E r e m o v e $ { c m a k e _ i n s t a l l _ f i l e }
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h $ { c m a k e _ i n s t a l l _ f i l e }
C O M M E N T " R e m o v i n g c m a k e _ i n s t a l l . c m a k e "
M A I N _ D E P E N D E N C Y $ { f i l e _ i n } )
add_custom_target ( remove_cmake_install ALL DEPENDS ${ file_generated } )
endfunction ( )
2019-06-25 10:09:10 +00:00
function ( qt_set_up_nonprefix_build )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
if ( NOT QT_WILL_INSTALL )
2019-11-13 13:03:20 +00:00
qt_remove_install_target ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
endif ( )
endfunction ( )
2019-07-30 09:15:32 +00:00
function ( qt_is_imported_target target out_var )
if ( NOT TARGET "${target}" )
set ( target "${QT_CMAKE_EXPORT_NAMESPACE}::${target}" )
endif ( )
if ( NOT TARGET "${target}" )
message ( FATAL_ERROR "Invalid target given to qt_is_imported_target: ${target}" )
endif ( )
get_target_property ( is_imported "${target}" IMPORTED )
set ( ${ out_var } "${is_imported}" PARENT_SCOPE )
endfunction ( )
2019-05-29 14:56:49 +00:00
# Generates module .pri files for consumption by qmake
2019-06-05 11:49:08 +00:00
function ( qt_generate_module_pri_file target target_path pri_files_var )
2019-08-19 13:07:22 +00:00
set ( flags INTERNAL_MODULE HEADER_MODULE )
2019-05-29 14:56:49 +00:00
set ( options )
set ( multiopts QMAKE_MODULE_CONFIG )
cmake_parse_arguments ( arg "${flags}" "${options}" "${multiopts}" ${ ARGN } )
qt_internal_module_info ( module "${target}" )
2019-06-06 08:11:15 +00:00
set ( pri_files )
2019-05-29 14:56:49 +00:00
2019-08-19 13:07:22 +00:00
set ( property_prefix )
if ( arg_HEADER_MODULE )
set ( property_prefix "interface_" )
endif ( )
get_target_property ( enabled_features "${target}"
" $ { p r o p e r t y _ p r e f i x } Q T _ E N A B L E D _ P U B L I C _ F E A T U R E S " )
get_target_property ( disabled_features "${target}"
" $ { p r o p e r t y _ p r e f i x } Q T _ D I S A B L E D _ P U B L I C _ F E A T U R E S " )
get_target_property ( enabled_private_features "${target}"
" $ { p r o p e r t y _ p r e f i x } Q T _ E N A B L E D _ P R I V A T E _ F E A T U R E S " )
get_target_property ( disabled_private_features "${target}"
" $ { p r o p e r t y _ p r e f i x } Q T _ D I S A B L E D _ P R I V A T E _ F E A T U R E S " )
2019-06-05 11:49:08 +00:00
foreach ( var enabled_features disabled_features enabled_private_features disabled_private_features )
if ( ${ var } STREQUAL "${var}-NOTFOUND" )
set ( ${ var } "" )
else ( )
string ( REPLACE ";" " " ${ var } "${${var}}" )
endif ( )
endforeach ( )
2019-05-29 14:56:49 +00:00
if ( arg_QMAKE_MODULE_CONFIG )
string ( REPLACE ";" " " module_config "${arg_QMAKE_MODULE_CONFIG}" )
set ( module_config "\nQT.${module_lower}.CONFIG = ${module_config}" )
else ( )
set ( module_config "" )
endif ( )
2019-06-05 11:49:08 +00:00
if ( NOT ${ arg_INTERNAL_MODULE } )
2019-06-06 08:11:15 +00:00
qt_path_join ( pri_file_name "${target_path}" "qt_lib_${module_lower}.pri" )
list ( APPEND pri_files "${pri_file_name}" )
2019-06-05 11:49:08 +00:00
file ( GENERATE
O U T P U T " $ { p r i _ f i l e _ n a m e } "
C O N T E N T
2019-05-29 14:56:49 +00:00
" Q T . $ { m o d u l e _ l o w e r } . V E R S I O N = $ { P R O J E C T _ V E R S I O N }
Q T . $ { m o d u l e _ l o w e r } . n a m e = $ { m o d u l e }
Q T . $ { m o d u l e _ l o w e r } . m o d u l e = $ { m o d u l e _ v e r s i o n e d }
Q T . $ { m o d u l e _ l o w e r } . l i b s = $ $ Q T _ M O D U L E _ L I B _ B A S E
Q T . $ { m o d u l e _ l o w e r } . i n c l u d e s = $ $ Q T _ M O D U L E _ I N C L U D E _ B A S E $ $ Q T _ M O D U L E _ I N C L U D E _ B A S E / $ { m o d u l e }
Q T . $ { m o d u l e _ l o w e r } . f r a m e w o r k s =
Q T . $ { m o d u l e _ l o w e r } . b i n s = $ $ Q T _ M O D U L E _ B I N _ B A S E
Q T . $ { m o d u l e _ l o w e r } . d e p e n d s =
Q T . $ { m o d u l e _ l o w e r } . u s e s =
Q T . $ { m o d u l e _ l o w e r } . m o d u l e _ c o n f i g = v 2
2019-06-05 09:31:55 +00:00
Q T . $ { m o d u l e _ l o w e r } . D E F I N E S = Q T _ $ { m o d u l e _ d e f i n e } _ L I B
2019-05-29 14:56:49 +00:00
Q T . $ { m o d u l e _ l o w e r } . e n a b l e d _ f e a t u r e s = $ { e n a b l e d _ f e a t u r e s }
Q T . $ { m o d u l e _ l o w e r } . d i s a b l e d _ f e a t u r e s = $ { d i s a b l e d _ f e a t u r e s } $ { m o d u l e _ c o n f i g }
Q T _ M O D U L E S + = $ { m o d u l e _ l o w e r }
2019-06-05 11:49:08 +00:00
"
)
endif ( )
qt_path_join ( private_pri_file "${target_path}" "qt_lib_${module_lower}_private.pri" )
list ( APPEND pri_files "${private_pri_file}" )
file ( GENERATE
O U T P U T " $ { p r i v a t e _ p r i _ f i l e } "
C O N T E N T
" Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . V E R S I O N = $ { P R O J E C T _ V E R S I O N }
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . n a m e = $ { m o d u l e }
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . m o d u l e =
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . l i b s = $ $ Q T _ M O D U L E _ L I B _ B A S E
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . i n c l u d e s = $ $ Q T _ M O D U L E _ I N C L U D E _ B A S E / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } $ $ Q T _ M O D U L E _ I N C L U D E _ B A S E / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e }
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . f r a m e w o r k s =
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . d e p e n d s = $ { m o d u l e _ l o w e r }
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . u s e s =
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . m o d u l e _ c o n f i g = v 2
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . e n a b l e d _ f e a t u r e s = $ { e n a b l e d _ p r i v a t e _ f e a t u r e s }
Q T . $ { m o d u l e _ l o w e r } _ p r i v a t e . d i s a b l e d _ f e a t u r e s = $ { d i s a b l e d _ p r i v a t e _ f e a t u r e s }
2019-05-29 14:56:49 +00:00
"
)
2019-06-05 11:49:08 +00:00
set ( "${pri_files_var}" "${pri_files}" PARENT_SCOPE )
2019-05-29 14:56:49 +00:00
endfunction ( )
function ( qt_generate_global_config_pri_file )
2020-01-15 22:01:16 +00:00
qt_path_join ( qconfig_pri_target_path ${ PROJECT_BINARY_DIR } ${ INSTALL_MKSPECSDIR } )
2019-05-29 14:56:49 +00:00
qt_path_join ( qconfig_pri_target_path "${qconfig_pri_target_path}" "qconfig.pri" )
get_target_property ( enabled_features GlobalConfig INTERFACE_QT_ENABLED_PUBLIC_FEATURES )
get_target_property ( disabled_features GlobalConfig INTERFACE_QT_DISABLED_PUBLIC_FEATURES )
# configure2cmake skips the "static" feature, so emulate it here for qmake support:
2019-05-31 14:40:51 +00:00
if ( QT_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS )
2019-05-29 14:56:49 +00:00
list ( APPEND enabled_features shared )
list ( APPEND disabled_features static )
2019-05-31 14:40:51 +00:00
set ( qt_build_config_type "shared" )
2019-05-29 14:56:49 +00:00
else ( )
list ( APPEND enabled_features static )
list ( APPEND disabled_features shared )
2019-05-31 14:40:51 +00:00
set ( qt_build_config_type "static" )
2019-05-29 14:56:49 +00:00
endif ( )
# configure2cmake skips the "rpath" feature, so emulate it here for qmake support:
if ( CMAKE_SKIP_RPATH )
list ( APPEND disabled_features rpath )
elseif ( LINUX OR APPLE )
list ( APPEND enabled_features rpath )
endif ( )
string ( REPLACE ";" " " enabled_features "${enabled_features}" )
string ( REPLACE ";" " " disabled_features "${disabled_features}" )
2019-05-31 14:40:51 +00:00
# Add some required CONFIG entries.
set ( config_entries "" )
if ( CMAKE_BUILD_TYPE STREQUAL Debug )
list ( APPEND config_entries "debug" )
elseif ( CMAKE_BUILD_TYPE STREQUAL Release )
list ( APPEND config_entries "release" )
endif ( )
list ( APPEND config_entries "${qt_build_config_type}" )
string ( REPLACE ";" " " config_entries "${config_entries}" )
2019-05-29 14:56:49 +00:00
file ( GENERATE
O U T P U T " $ { q c o n f i g _ p r i _ t a r g e t _ p a t h } "
C O N T E N T
2019-05-31 08:58:43 +00:00
" Q T _ A R C H = $ { T E S T _ a r c h i t e c t u r e _ a r c h }
Q T _ B U I L D A B I = $ { T E S T _ b u i l d A b i }
Q T . g l o b a l . e n a b l e d _ f e a t u r e s = $ { e n a b l e d _ f e a t u r e s }
2019-05-29 14:56:49 +00:00
Q T . g l o b a l . d i s a b l e d _ f e a t u r e s = $ { d i s a b l e d _ f e a t u r e s }
Q T _ V E R S I O N = $ { P R O J E C T _ V E R S I O N }
Q T _ M A J O R _ V E R S I O N = $ { P R O J E C T _ V E R S I O N _ M A J O R }
Q T _ M I N O R _ V E R S I O N = $ { P R O J E C T _ V E R S I O N _ M I N O R }
Q T _ P A T C H _ V E R S I O N = $ { P R O J E C T _ V E R S I O N _ P A T C H }
C O N F I G - = l i n k _ p r l # we do not create prl files right now
2019-05-31 14:40:51 +00:00
C O N F I G + = $ { c o n f i g _ e n t r i e s }
2019-05-29 14:56:49 +00:00
"
)
2020-01-15 22:01:16 +00:00
qt_install ( FILES "${qconfig_pri_target_path}" DESTINATION ${ INSTALL_MKSPECSDIR } )
2019-05-29 14:56:49 +00:00
endfunction ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
# Takes a list of path components and joins them into one path separated by forward slashes "/",
# and saves the path in out_var.
function ( qt_path_join out_var )
# Remove output variable.
set ( argv ${ ARGV } )
list ( REMOVE_AT argv 0 )
# Join the path components.
string ( JOIN "/" path ${ argv } )
set ( ${ out_var } ${ path } PARENT_SCOPE )
endfunction ( )
2019-05-03 10:30:09 +00:00
function ( qt_internal_export_modern_cmake_config_targets_file )
cmake_parse_arguments ( __arg "" "EXPORT_NAME_PREFIX;CONFIG_INSTALL_DIR" "TARGETS" ${ ARGN } )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( export_name "${__arg_EXPORT_NAME_PREFIX}VersionlessTargets" )
2019-05-03 10:30:09 +00:00
foreach ( target ${ __arg_TARGETS } )
if ( TARGET "${target}Versionless" )
continue ( )
endif ( )
add_library ( "${target}Versionless" INTERFACE )
target_link_libraries ( "${target}Versionless" INTERFACE "${target}" )
set_target_properties ( "${target}Versionless" PROPERTIES EXPORT_NAME "${target}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( TARGETS "${target}Versionless" EXPORT ${ export_name } )
2019-05-03 10:30:09 +00:00
endforeach ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( EXPORT ${ export_name } NAMESPACE Qt:: DESTINATION "${__arg_CONFIG_INSTALL_DIR}" )
2019-05-03 10:30:09 +00:00
endfunction ( )
2018-10-24 13:20:27 +00:00
# Print all variables defined in the current scope.
macro ( qt_debug_print_variables )
cmake_parse_arguments ( __arg "DEDUP" "" "MATCH;IGNORE" ${ ARGN } )
message ( "Known Variables:" )
get_cmake_property ( __variableNames VARIABLES )
list ( SORT __variableNames )
if ( __arg_DEDUP )
list ( REMOVE_DUPLICATES __variableNames )
endif ( )
foreach ( __var ${ __variableNames } )
set ( __ignore OFF )
foreach ( __i ${ __arg_IGNORE } )
if ( __var MATCHES "${__i}" )
set ( __ignore ON )
break ( )
endif ( )
endforeach ( )
if ( __ignore )
continue ( )
endif ( )
set ( __show OFF )
foreach ( __i ${ __arg_MATCH } )
if ( __var MATCHES "${__i}" )
set ( __show ON )
break ( )
endif ( )
endforeach ( )
if ( __show )
message ( " ${__var}=${${__var}}." )
endif ( )
endforeach ( )
endmacro ( )
macro ( assert )
if ( ${ ARGN } )
else ( )
message ( FATAL_ERROR "ASSERT: ${ARGN}." )
endif ( )
endmacro ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
function ( qt_create_nolink_target target dependee_target )
2019-03-28 14:25:17 +00:00
if ( NOT TARGET "${target}" )
message ( FATAL_ERROR "${target} does not exist when trying to build a nolink target." )
endif ( )
get_target_property ( type "${target}" TYPE )
if ( type STREQUAL EXECUTABLE )
message ( FATAL_ERROR "${target} must be a library of some kind." )
endif ( )
if ( type STREQUAL OBJECT_LIBRARY )
message ( FATAL_ERROR "${target} must not be an object library." )
endif ( )
2019-05-03 13:21:30 +00:00
# Strip off the namespace prefix, so from Vulkan::Vulkan to Vulkan, and then append _nolink.
string ( REGEX REPLACE "^.*::" "" non_prefixed_target ${ target } )
set ( nolink_target "${non_prefixed_target}_nolink" )
# Create the nolink interface target, assign the properties from the original target,
# associate the nolink target with the same export which contains
# the target that uses the _nolink target.
2019-11-07 12:18:21 +00:00
# Also create a namespaced alias of the form ${target}::${target}_nolink which is used by
2019-05-03 13:21:30 +00:00
# our modules.
2019-11-07 12:18:21 +00:00
# Also create a Qt namespaced alias target, because when exporting via install(EXPORT)
# Vulkan::Vulkan_nolink transforms into Qt6::Vulkan_nolink, and the latter needs to be an
# accessible alias for standalone tests.
2019-03-28 14:25:17 +00:00
if ( NOT TARGET "${nolink_target}" )
2019-05-03 13:21:30 +00:00
add_library ( "${nolink_target}" INTERFACE )
set ( prefixed_nolink_target "${target}_nolink" )
2019-04-10 10:12:09 +00:00
set_target_properties ( "${nolink_target}" PROPERTIES
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S >
I N T E R F A C E _ S Y S T E M _ I N C L U D E _ D I R E C T O R I E S
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N T E R F A C E _ S Y S T E M _ I N C L U D E _ D I R E C T O R I E S >
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S >
I N T E R F A C E _ C O M P I L E _ O P T I O N S
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N T E R F A C E _ C O M P I L E _ O P T I O N S >
I N T E R F A C E _ C O M P I L E _ F E A T U R E S
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N T E R F A C E _ C O M P I L E _ F E A T U R E S > )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
2019-05-03 13:21:30 +00:00
add_library ( ${ prefixed_nolink_target } ALIAS ${ nolink_target } )
2019-11-07 12:18:21 +00:00
add_library ( "${INSTALL_CMAKE_NAMESPACE}::${nolink_target}" ALIAS ${ nolink_target } )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( export_name "${INSTALL_CMAKE_NAMESPACE}${dependee_target}Targets" )
qt_install ( TARGETS ${ nolink_target } EXPORT ${ export_name } )
2019-03-28 14:25:17 +00:00
endif ( )
endfunction ( )
2018-10-24 13:20:27 +00:00
function ( qt_ensure_perl )
if ( DEFINED HOST_PERL )
return ( )
endif ( )
find_program ( HOST_PERL "perl" DOC "Perl binary" )
if ( NOT HOST_PERL )
message ( FATAL_ERROR "Perl needs to be available to build Qt." )
endif ( )
endfunction ( )
2018-12-07 13:04:42 +00:00
function ( qt_ensure_sync_qt )
qt_ensure_perl ( )
2019-02-12 21:39:35 +00:00
if ( DEFINED QT_SYNCQT )
return ( )
2018-12-07 13:04:42 +00:00
endif ( )
2019-02-12 21:39:35 +00:00
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
# When building qtbase, use the source syncqt, otherwise use the installed one.
2019-06-05 14:23:53 +00:00
set ( SYNCQT_FROM_SOURCE "${QtBase_SOURCE_DIR}/bin/syncqt.pl" )
2019-09-18 15:05:56 +00:00
if ( NOT ( "${QtBase_SOURCE_DIR}" STREQUAL "" ) AND EXISTS "${SYNCQT_FROM_SOURCE}" )
2019-06-05 14:23:53 +00:00
set ( QT_SYNCQT "${SYNCQT_FROM_SOURCE}" CACHE FILEPATH "syncqt script" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
message ( STATUS "Using source syncqt found at: ${QT_SYNCQT}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_path_join ( syncqt_install_dir ${ QT_INSTALL_DIR } ${ INSTALL_LIBEXECDIR } )
2019-06-05 14:23:53 +00:00
qt_copy_or_install ( PROGRAMS "${SYNCQT_FROM_SOURCE}"
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
D E S T I N A T I O N " $ { s y n c q t _ i n s t a l l _ d i r } " )
2020-01-21 10:45:38 +00:00
elseif ( QT_HOST_PATH )
get_filename_component ( syncqt_absolute_path
" $ { Q T _ H O S T _ P A T H } / $ { I N S T A L L _ L I B E X E C D I R } / s y n c q t . p l "
A B S O L U T E )
set ( QT_SYNCQT "${syncqt_absolute_path}" CACHE FILEPATH "syncqt script" )
message ( STATUS "Using host syncqt found at: ${QT_SYNCQT}" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
else ( )
get_filename_component ( syncqt_absolute_path
" $ { C M A K E _ I N S T A L L _ P R E F I X } / $ { I N S T A L L _ L I B E X E C D I R } / s y n c q t . p l "
A B S O L U T E )
set ( QT_SYNCQT "${syncqt_absolute_path}" CACHE FILEPATH "syncqt script" )
message ( STATUS "Using installed syncqt found at: ${QT_SYNCQT}" )
endif ( )
2018-12-07 13:04:42 +00:00
endfunction ( )
2018-10-24 13:20:27 +00:00
# A version of cmake_parse_arguments that makes sure all arguments are processed and errors out
# with a message about ${type} having received unknown arguments.
macro ( qt_parse_all_arguments result type flags options multiopts )
cmake_parse_arguments ( ${ result } "${flags}" "${options}" "${multiopts}" ${ ARGN } )
if ( DEFINED ${ result } _UNPARSED_ARGUMENTS )
message ( FATAL_ERROR "Unknown arguments were passed to ${type} (${${result}_UNPARSED_ARGUMENTS})." )
endif ( )
endmacro ( )
2019-11-22 16:02:19 +00:00
include ( CheckCXXSourceCompiles )
2018-10-24 13:20:27 +00:00
2019-02-27 12:49:04 +00:00
function ( qt_internal_add_link_flags_no_undefined target )
2019-08-28 13:02:28 +00:00
if ( NOT QT_BUILD_SHARED_LIBS )
return ( )
endif ( )
2019-02-27 12:49:04 +00:00
if ( GCC OR CLANG )
2019-11-22 16:02:19 +00:00
set ( previous_CMAKE_REQUIRED_LINK_OPTIONS ${ CMAKE_REQUIRED_LINK_OPTIONS } )
set ( CMAKE_REQUIRED_LINK_OPTIONS "-Wl,-undefined,error" )
check_cxx_source_compiles ( "int main() {}" HAVE_DASH_UNDEFINED_ERROR )
if ( HAVE_DASH_UNDEFINED_ERROR )
2019-02-27 12:49:04 +00:00
set ( no_undefined_flag "-Wl,-undefined,error" )
2019-11-22 16:02:19 +00:00
endif ( )
set ( CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--no-undefined" )
check_cxx_source_compiles ( "int main() {}" HAVE_DASH_DASH_NO_UNDEFINED )
if ( HAVE_DASH_DASH_NO_UNDEFINED )
2019-02-27 12:49:04 +00:00
set ( no_undefined_flag "-Wl,--no-undefined" )
2019-11-22 16:02:19 +00:00
endif ( )
set ( CMAKE_REQUIRED_LINK_OPTIONS ${ previous_CMAKE_REQUIRED_LINK_OPTIONS } )
if ( NOT HAVE_DASH_UNDEFINED_ERROR AND NOT HAVE_DASH_DASH_NO_UNDEFINED )
2019-02-27 12:49:04 +00:00
message ( FATAL_ERROR "Platform linker doesn't support erroring upon encountering undefined symbols. Target:\" ${ target } \".")
endif ( )
2019-03-04 12:05:54 +00:00
target_link_options ( "${target}" PRIVATE "${no_undefined_flag}" )
endif ( )
endfunction ( )
function ( qt_internal_add_link_flags_gc_sections target visibility )
set ( possible_visibilities PRIVATE INTERFACE PUBLIC )
list ( FIND possible_visibilities "${visibility}" known_visibility )
if ( known_visibility EQUAL "-1" )
message ( FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC." )
endif ( )
2019-08-28 13:02:28 +00:00
if ( ( GCC OR CLANG ) AND NOT EMSCRIPTEN )
2019-03-04 12:05:54 +00:00
if ( APPLE )
set ( gc_sections_flag "-Wl,-dead_strip" )
2019-05-29 08:08:56 +00:00
elseif ( LINUX OR BSD OR SOLARIS OR WIN32 OR ANDROID )
2019-03-04 12:05:54 +00:00
set ( gc_sections_flag "-Wl,--gc-sections" )
else ( )
message ( FATAL_ERROR "Platform linker doesn't support gc sections. Target:\" ${ target } \".")
endif ( )
target_link_options ( "${target}" ${ visibility } "${gc_sections_flag}" )
2019-02-27 12:49:04 +00:00
endif ( )
endfunction ( )
2018-10-24 13:20:27 +00:00
function ( qt_internal_add_linker_version_script target )
2018-12-07 12:13:24 +00:00
qt_parse_all_arguments ( arg "qt_internal_add_linker" "INTERNAL" "" "PRIVATE_HEADERS" ${ ARGN } )
2018-10-24 13:20:27 +00:00
if ( TEST_ld_version_script )
2018-12-07 12:13:24 +00:00
if ( arg_INTERNAL )
2018-10-24 13:20:27 +00:00
set ( contents "Qt_${PROJECT_VERSION_MAJOR}_PRIVATE_API { *; };" )
else ( )
set ( contents "Qt_${PROJECT_VERSION_MAJOR}_PRIVATE_API {\n qt_private_api_tag*;\n" )
2018-12-07 12:13:24 +00:00
foreach ( ph ${ arg_PRIVATE_HEADERS } )
2018-10-24 13:20:27 +00:00
string ( APPEND contents " @FILE:${ph}@\n" )
endforeach ( )
string ( APPEND contents "};\n" )
set ( current "Qt_${PROJECT_VERSION_MAJOR}" )
if ( QT_NAMESPACE STREQUAL "" )
set ( tag_symbol "qt_version_tag" )
else ( )
set ( tag_symbol "qt_version_tag_${QT_NAMESPACE}" )
endif ( )
string ( APPEND contents "${current} { *; };\n" )
foreach ( minor_version RANGE ${ PROJECT_VERSION_MINOR } )
set ( previous "${current}" )
set ( current "Qt_${PROJECT_VERSION_MAJOR}.${minor_version}" )
if ( minor_version EQUAL ${ PROJECT_VERSION_MINOR } )
string ( APPEND contents "${current} { ${tag_symbol}; } ${previous};\n" )
else ( )
string ( APPEND contents "${current} {} ${previous};\n" )
endif ( )
endforeach ( )
set ( infile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version.in" )
set ( outfile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version" )
file ( GENERATE OUTPUT "${infile}" CONTENT "${contents}" )
qt_ensure_perl ( )
add_custom_command ( TARGET "${target}" PRE_LINK
2019-11-21 12:33:28 +00:00
C O M M A N D " $ { H O S T _ P E R L } " " $ { Q T _ M K S P E C S _ D I R } / f e a t u r e s / d a t a / u n i x / f i n d c l a s s l i s t . p l " < " $ { i n f i l e } " > " $ { o u t f i l e } "
2018-10-24 13:20:27 +00:00
B Y P R O D U C T S " $ { o u t f i l e } " D E P E N D S " $ { i n f i l e } "
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
C O M M E N T " G e n e r a t i n g v e r s i o n l i n k e r s c r i p t "
)
2019-03-04 12:05:54 +00:00
target_link_options ( "${target}" PRIVATE "-Wl,--version-script,${outfile}" )
2018-10-24 13:20:27 +00:00
endif ( )
endif ( )
endfunction ( )
2018-12-07 12:30:51 +00:00
# Get a set of Qt module related values based on the target name.
# When doing qt_internal_module_info(foo Core) this method will set
# the following variables in the caller's scope:
# * foo with the value "QtCore"
2019-06-14 10:59:07 +00:00
# * foo_versioned with the value "Qt6Core" (based on major Qt version)
2018-12-07 12:30:51 +00:00
# * foo_upper with the value "CORE"
# * foo_lower with the value "core"
2019-08-08 14:55:48 +00:00
# * foo_repo_include_dir with the module's include directory
# e.g for QtQuick it would be qtdeclarative_build_dir/include for a prefix build or
# qtbase_build_dir/include for a non-prefix build
# * foo_include_dir with the module's include directory
# e.g for QtQuick it would be qtdeclarative_build_dir/include/QtQuick for a prefix build or
# qtbase_build_dir/include/QtQuick for a non-prefix build
2019-06-05 09:31:55 +00:00
# * foo_define same as foo_uper but with - replaced as _
2018-12-07 12:30:51 +00:00
function ( qt_internal_module_info result target )
2018-12-07 13:04:42 +00:00
set ( module "Qt${target}" )
set ( "${result}" "${module}" PARENT_SCOPE )
2018-12-07 12:30:51 +00:00
set ( "${result}_versioned" "Qt${PROJECT_VERSION_MAJOR}${target}" PARENT_SCOPE )
string ( TOUPPER "${target}" upper )
2019-06-05 09:31:55 +00:00
string ( TOLOWER "${target}" lower ) # * foo_upper with the value "CORE"
string ( REPLACE "-" "_" define "${upper}" )
2019-08-12 08:46:50 +00:00
string ( REPLACE "." "_" define "${define}" )
2018-12-07 12:30:51 +00:00
set ( "${result}_upper" "${upper}" PARENT_SCOPE )
set ( "${result}_lower" "${lower}" PARENT_SCOPE )
2020-01-26 11:25:40 +00:00
set ( "${result}_repo_include_dir" "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}" PARENT_SCOPE )
set ( "${result}_include_dir" "${QT_BUILD_DIR}/${INSTALL_INCLUDEDIR}/${module}" PARENT_SCOPE )
2019-06-05 09:31:55 +00:00
set ( "${result}_define" "${define}" PARENT_SCOPE )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-05-03 14:03:15 +00:00
set ( __default_private_args "SOURCES;LIBRARIES;INCLUDE_DIRECTORIES;DEFINES;DBUS_ADAPTOR_BASENAME;DBUS_ADAPTOR_FLAGS;DBUS_ADAPTOR_SOURCES;DBUS_INTERFACE_BASENAME;DBUS_INTERFACE_FLAGS;DBUS_INTERFACE_SOURCES;FEATURE_DEPENDENCIES;COMPILE_OPTIONS;LINK_OPTIONS;MOC_OPTIONS;DISABLE_AUTOGEN_TOOLS;ENABLE_AUTOGEN_TOOLS;PLUGIN_TYPES" )
2019-01-29 11:07:24 +00:00
set ( __default_public_args "PUBLIC_LIBRARIES;PUBLIC_INCLUDE_DIRECTORIES;PUBLIC_DEFINES;PUBLIC_COMPILE_OPTIONS;PUBLIC_LINK_OPTIONS" )
2020-01-31 21:21:09 +00:00
set ( __default_private_module_args "PRIVATE_MODULE_INTERFACE" )
2018-10-24 13:20:27 +00:00
2019-01-30 15:36:30 +00:00
option ( QT_CMAKE_DEBUG_EXTEND_TARGET "Debug extend_target calls in Qt's build system" OFF )
2019-05-22 13:09:39 +00:00
# Initial autogen setup for a target to specify certain CMake properties which are common
# to all autogen tools. Also enable AUTOMOC by default.
function ( qt_autogen_tools_initial_setup target )
set_property ( TARGET "${target}" PROPERTY INTERFACE_QT_MAJOR_VERSION ${ PROJECT_VERSION_MAJOR } )
set_property ( TARGET "${target}" APPEND PROPERTY COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION )
2019-03-06 12:51:38 +00:00
2019-05-22 13:09:39 +00:00
set_directory_properties ( PROPERTIES
2019-12-11 15:14:22 +00:00
Q T _ V E R S I O N _ M A J O R $ { P R O J E C T _ V E R S I O N _ M A J O R }
Q T _ V E R S I O N _ M I N O R $ { P R O J E C T _ V E R S I O N _ M I N O R }
Q T _ V E R S I O N _ P A T C H $ { P R O J E C T _ V E R S I O N _ P A T C H }
)
2019-03-06 12:51:38 +00:00
2019-05-22 13:09:39 +00:00
qt_enable_autogen_tool ( ${ target } "moc" ON )
endfunction ( )
# Enables or disables an autogen tool like moc, uic or rcc on ${target}.
function ( qt_enable_autogen_tool target tool enable )
string ( TOUPPER "${tool}" captitalAutogenTool )
get_target_property ( tool_enabled ${ target } AUTO ${ captitalAutogenTool } )
get_target_property ( autogen_target_depends ${ target } AUTOGEN_TARGET_DEPENDS )
2019-03-06 12:51:38 +00:00
2019-05-22 13:09:39 +00:00
if ( NOT autogen_target_depends )
set ( autogen_target_depends "" )
endif ( )
set ( tool_executable "$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::${tool}>" )
set ( tool_target_name ${ QT_CMAKE_EXPORT_NAMESPACE } :: ${ tool } )
if ( enable )
list ( APPEND autogen_target_depends ${ tool_target_name } )
else ( )
list ( REMOVE_ITEM autogen_target_depends ${ tool_target_name } )
endif ( )
2019-03-06 12:51:38 +00:00
2019-07-11 14:23:54 +00:00
# f66c1db16c050c9d685a44a38ad7c5cf9f6fcc96 in qtbase introduced a new macro
# that the moc scanner has to look for. Inform the CMake moc scanner about it.
if ( tool STREQUAL "moc" AND enable )
set_target_properties ( "${target}" PROPERTIES
2019-09-16 15:07:28 +00:00
A U T O M O C _ M A C R O _ N A M E S " Q _ O B J E C T ; Q _ G A D G E T ; Q _ N A M E S P A C E ; Q _ N A M E S P A C E _ E X P O R T ; Q _ E N U M _ N S " )
2019-07-11 14:23:54 +00:00
endif ( )
2019-03-06 12:51:38 +00:00
set_target_properties ( "${target}"
P R O P E R T I E S
2019-05-22 13:09:39 +00:00
A U T O $ { c a p t i t a l A u t o g e n T o o l } " $ { e n a b l e } "
A U T O $ { c a p t i t a l A u t o g e n T o o l } _ E X E C U T A B L E " $ { t o o l _ e x e c u t a b l e } "
A U T O G E N _ T A R G E T _ D E P E N D S " $ { a u t o g e n _ t a r g e t _ d e p e n d s } "
)
endfunction ( )
# This function adds or removes additional AUTOGEN tools to a target: AUTOMOC/UIC/RCC
function ( qt_autogen_tools target )
qt_parse_all_arguments ( arg "qt_autogen_tools" "" "" "${__default_private_args}" ${ ARGN } )
if ( arg_ENABLE_AUTOGEN_TOOLS )
foreach ( tool ${ arg_ENABLE_AUTOGEN_TOOLS } )
qt_enable_autogen_tool ( ${ target } ${ tool } ON )
endforeach ( )
endif ( )
if ( arg_DISABLE_AUTOGEN_TOOLS )
foreach ( tool ${ arg_DISABLE_AUTOGEN_TOOLS } )
qt_enable_autogen_tool ( ${ target } ${ tool } OFF )
endforeach ( )
endif ( )
2019-03-06 12:51:38 +00:00
endfunction ( )
2019-05-03 14:03:15 +00:00
# This function stores the list of Qt modules a library depend on,
# along with their version info, for usage in ${target}Depends.cmake file
function ( qt_register_target_dependencies target public_libs private_libs )
get_target_property ( target_deps "${target}" _qt_target_deps )
if ( NOT target_deps )
set ( target_deps "" )
endif ( )
2020-02-11 15:49:54 +00:00
# Only process private dependencies if target is a static library
get_target_property ( target_type ${ target } TYPE )
set ( lib_list ${ public_libs } )
if ( target_type STREQUAL "STATIC_LIBRARY" )
list ( APPEND lib_list ${ private_libs } )
endif ( )
foreach ( lib IN LISTS lib_list )
2019-05-03 14:03:15 +00:00
if ( "${lib}" MATCHES "^Qt::(.*)" )
set ( lib "${CMAKE_MATCH_1}" )
2019-06-12 15:43:25 +00:00
if ( lib STREQUAL Platform
O R l i b S T R E Q U A L G l o b a l C o n f i g
O R l i b S T R E Q U A L G l o b a l C o n f i g P r i v a t e
2019-06-12 13:08:24 +00:00
O R l i b S T R E Q U A L P l a t f o r m M o d u l e I n t e r n a l
O R l i b S T R E Q U A L P l a t f o r m P l u g i n I n t e r n a l
O R l i b S T R E Q U A L P l a t f o r m T o o l I n t e r n a l )
2019-06-14 10:59:07 +00:00
list ( APPEND target_deps "Qt6\;${PROJECT_VERSION}" )
2019-05-03 14:03:15 +00:00
elseif ( "${lib}" MATCHES "(.*)Private" )
list ( APPEND target_deps "${INSTALL_CMAKE_NAMESPACE}${CMAKE_MATCH_1}\;${PROJECT_VERSION}" )
else ( )
list ( APPEND target_deps "${INSTALL_CMAKE_NAMESPACE}${lib}\;${PROJECT_VERSION}" )
endif ( )
endif ( )
endforeach ( )
set_target_properties ( "${target}" PROPERTIES _qt_target_deps "${target_deps}" )
endfunction ( )
2019-07-05 08:47:26 +00:00
function ( qt_update_precompiled_header target precompiled_header )
if ( precompiled_header AND BUILD_WITH_PCH )
2019-10-15 13:42:50 +00:00
set_property ( TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<COMPILE_LANGUAGE:CXX>:${precompiled_header}>" )
2019-07-05 08:47:26 +00:00
endif ( )
endfunction ( )
function ( qt_update_precompiled_header_with_library target library )
if ( TARGET "${library}" )
get_target_property ( TARGET_TYPE "${library}" TYPE )
if ( NOT TARGET_TYPE STREQUAL "INTERFACE_LIBRARY" )
get_target_property ( HEADER "${library}" MODULE_HEADER )
qt_update_precompiled_header ( "${target}" "${HEADER}" )
endif ( )
endif ( )
endfunction ( )
function ( qt_update_ignore_pch_source target sources )
if ( sources )
set_source_files_properties ( ${ sources } PROPERTIES SKIP_PRECOMPILE_HEADERS ON )
endif ( )
endfunction ( )
function ( qt_ignore_pch_obj_c_sources target sources )
list ( FILTER sources INCLUDE REGEX "\\.mm$" )
qt_update_ignore_pch_source ( "${target}" "${sources}" )
endfunction ( )
2018-10-24 13:20:27 +00:00
# This function can be used to add sources/libraries/etc. to the specified CMake target
# if the provided CONDITION evaluates to true.
2019-11-13 13:03:20 +00:00
function ( qt_extend_target target )
2019-07-30 09:15:32 +00:00
# Don't try to extend_target when cross compiling an imported host target (like a tool).
qt_is_imported_target ( "${target}" is_imported )
if ( is_imported )
return ( )
endif ( )
2018-10-24 13:20:27 +00:00
if ( NOT TARGET "${target}" )
message ( FATAL_ERROR "Trying to extend non-existing target \" ${ target } \".")
endif ( )
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_extend_target" "HEADER_MODULE" "PRECOMPILED_HEADER"
2020-01-31 21:21:09 +00:00
" C O N D I T I O N ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } ; $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p r i v a t e _ m o d u l e _ a r g s } ; C O M P I L E _ F L A G S ; N O _ P C H _ S O U R C E S " $ { A R G N } )
2018-12-07 12:13:24 +00:00
if ( "x${arg_CONDITION}" STREQUAL x )
set ( arg_CONDITION ON )
2018-10-24 13:20:27 +00:00
endif ( )
2018-12-07 12:13:24 +00:00
qt_evaluate_config_expression ( result ${ arg_CONDITION } )
2018-10-24 13:20:27 +00:00
if ( ${ result } )
2019-01-30 15:36:30 +00:00
if ( QT_CMAKE_DEBUG_EXTEND_TARGET )
2019-11-13 13:03:20 +00:00
message ( "qt_extend_target(${target} CONDITION ${arg_CONDITION} ...): Evaluated" )
2019-01-30 15:36:30 +00:00
endif ( )
2018-10-29 15:53:51 +00:00
set ( dbus_sources "" )
2018-12-07 12:13:24 +00:00
foreach ( adaptor ${ arg_DBUS_ADAPTOR_SOURCES } )
2019-01-30 13:06:48 +00:00
qt_create_qdbusxml2cpp_command ( "${target}" "${adaptor}" ADAPTOR BASENAME "${arg_DBUS_ADAPTOR_BASENAME}" FLAGS "${arg_DBUS_ADAPTOR_FLAGS}" )
2018-10-29 15:53:51 +00:00
list ( APPEND dbus_sources "${sources}" )
endforeach ( )
2018-12-11 10:38:20 +00:00
2018-12-07 12:13:24 +00:00
foreach ( interface ${ arg_DBUS_INTERFACE_SOURCES } )
2019-01-30 13:06:48 +00:00
qt_create_qdbusxml2cpp_command ( "${target}" "${interface}" INTERFACE BASENAME "${arg_DBUS_INTERFACE_BASENAME}" FLAGS "${arg_DBUS_INTERFACE_FLAGS}" )
2018-10-29 15:53:51 +00:00
list ( APPEND dbus_sources "${sources}" )
endforeach ( )
2018-10-24 13:20:27 +00:00
2019-09-19 15:22:43 +00:00
get_target_property ( target_type ${ target } TYPE )
set ( is_library FALSE )
if ( ${ target_type } STREQUAL "STATIC_LIBRARY" OR ${ target_type } STREQUAL "SHARED_LIBRARY" )
set ( is_library TRUE )
endif ( )
2019-03-28 14:25:17 +00:00
foreach ( lib ${ arg_PUBLIC_LIBRARIES } ${ arg_LIBRARIES } )
2019-09-19 15:22:43 +00:00
# Automatically generate PCH for 'target' using dependencies
# if 'target' is a library/module!
if ( ${ is_library } )
qt_update_precompiled_header_with_library ( "${target}" "${lib}" )
endif ( )
2019-03-28 14:25:17 +00:00
string ( REGEX REPLACE "_nolink$" "" base_lib "${lib}" )
if ( NOT base_lib STREQUAL lib )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_create_nolink_target ( "${base_lib}" ${ target } )
2019-03-28 14:25:17 +00:00
endif ( )
endforeach ( )
2019-05-03 09:38:41 +00:00
# Find dependencies to internal libraries
get_target_property ( target_deps "${target}" _qt_target_deps )
if ( NOT target_deps )
set ( target_deps "" )
endif ( )
foreach ( lib ${ arg_LIBRARIES } )
if ( TARGET "${lib}" )
get_target_property ( _is_exported "${lib}" INTERFACE_QT_EXPORTED_LIBRARY )
if ( "${_is_exported}" )
list ( APPEND target_deps "${lib}\;${PROJECT_VERSION}" )
endif ( )
endif ( )
endforeach ( )
# Set-up the target
2018-12-07 12:13:24 +00:00
target_sources ( "${target}" PRIVATE ${ arg_SOURCES } ${ dbus_sources } )
if ( arg_COMPILE_FLAGS )
set_source_files_properties ( ${ arg_SOURCES } PROPERTIES COMPILE_FLAGS "${arg_COMPILE_FLAGS}" )
2018-10-24 13:20:27 +00:00
endif ( )
2019-05-03 09:38:41 +00:00
2019-08-19 13:07:22 +00:00
set ( public_visibility_option "PUBLIC" )
set ( private_visibility_option "PRIVATE" )
if ( arg_HEADER_MODULE )
set ( public_visibility_option "INTERFACE" )
set ( private_visibility_option "INTERFACE" )
endif ( )
target_include_directories ( "${target}"
$ { p u b l i c _ v i s i b i l i t y _ o p t i o n } $ { a r g _ P U B L I C _ I N C L U D E _ D I R E C T O R I E S }
$ { p r i v a t e _ v i s i b i l i t y _ o p t i o n } $ { a r g _ I N C L U D E _ D I R E C T O R I E S } )
target_compile_definitions ( "${target}"
$ { p u b l i c _ v i s i b i l i t y _ o p t i o n } $ { a r g _ P U B L I C _ D E F I N E S }
$ { p r i v a t e _ v i s i b i l i t y _ o p t i o n } $ { a r g _ D E F I N E S } )
target_link_libraries ( "${target}"
$ { p u b l i c _ v i s i b i l i t y _ o p t i o n } $ { a r g _ P U B L I C _ L I B R A R I E S }
$ { p r i v a t e _ v i s i b i l i t y _ o p t i o n } $ { a r g _ L I B R A R I E S } )
target_compile_options ( "${target}"
$ { p u b l i c _ v i s i b i l i t y _ o p t i o n } $ { a r g _ P U B L I C _ C O M P I L E _ O P T I O N S }
$ { p r i v a t e _ v i s i b i l i t y _ o p t i o n } $ { a r g _ C O M P I L E _ O P T I O N S } )
target_link_options ( "${target}"
$ { p u b l i c _ v i s i b i l i t y _ o p t i o n } $ { a r g _ P U B L I C _ L I N K _ O P T I O N S }
$ { p r i v a t e _ v i s i b i l i t y _ o p t i o n } $ { a r g _ L I N K _ O P T I O N S } )
if ( NOT arg_HEADER_MODULE )
2020-01-29 15:52:29 +00:00
set_property ( TARGET "${target}" APPEND PROPERTY
2019-08-19 13:07:22 +00:00
A U T O M O C _ M O C _ O P T I O N S " $ { a r g _ M O C _ O P T I O N S } "
)
2020-01-29 15:52:29 +00:00
set_property ( TARGET "${target}" PROPERTY
_ q t _ t a r g e t _ d e p s " $ { t a r g e t _ d e p s } "
)
2019-08-19 13:07:22 +00:00
endif ( )
2019-06-05 08:08:44 +00:00
2019-06-05 20:26:12 +00:00
# When computing the private library dependencies, we need to check not only the known
2019-08-20 13:24:14 +00:00
# modules added by this repo's qt_build_repo(), but also all module dependencies that
# were found via find_package().
qt_internal_get_qt_all_known_modules ( known_modules )
2019-06-05 20:26:12 +00:00
# When a public module depends on a private module (Gui on CorePrivate)
# make its private module depend on the other private module (GuiPrivate will depend on
# CorePrivate).
2019-06-05 08:08:44 +00:00
set ( qt_libs_private "" )
2019-06-05 20:26:12 +00:00
foreach ( it ${ known_modules } )
2019-06-05 08:08:44 +00:00
list ( FIND arg_LIBRARIES "Qt::${it}Private" pos )
if ( pos GREATER -1 )
list ( APPEND qt_libs_private "Qt::${it}Private" )
endif ( )
endforeach ( )
set ( target_private "${target}Private" )
if ( TARGET "${target_private}" )
2020-01-31 21:21:09 +00:00
target_link_libraries ( "${target_private}"
I N T E R F A C E " $ { t a r g e t } " $ { a r g _ P R I V A T E _ M O D U L E _ I N T E R F A C E } )
2019-06-05 08:08:44 +00:00
endif ( )
2019-06-12 13:08:24 +00:00
qt_register_target_dependencies ( "${target}"
" $ { a r g _ P U B L I C _ L I B R A R I E S } "
" $ { q t _ l i b s _ p r i v a t e } ; $ { a r g _ L I B R A R I E S } " )
2019-06-05 08:08:44 +00:00
2019-05-22 13:09:39 +00:00
qt_autogen_tools ( ${ target }
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S } )
2019-07-05 08:47:26 +00:00
qt_update_precompiled_header ( "${target}" "${arg_PRECOMPILED_HEADER}" )
qt_update_ignore_pch_source ( "${target}" "${arg_NO_PCH_SOURCES}" )
## Ignore objective-c files for PCH (not supported atm)
qt_ignore_pch_obj_c_sources ( "${target}" "${arg_SOURCES}" )
2019-01-30 15:36:30 +00:00
else ( )
if ( QT_CMAKE_DEBUG_EXTEND_TARGET )
2019-11-13 13:03:20 +00:00
message ( "qt_extend_target(${target} CONDITION ${arg_CONDITION} ...): Skipped" )
2019-01-30 15:36:30 +00:00
endif ( )
2018-11-08 21:29:55 +00:00
endif ( )
2018-10-24 13:20:27 +00:00
endfunction ( )
function ( qt_internal_library_deprecation_level result )
if ( WIN32 )
# On Windows, due to the way DLLs work, we need to export all functions,
# including the inlines
2019-10-31 12:56:06 +00:00
list ( APPEND deprecations "QT_DISABLE_DEPRECATED_BEFORE=0x040800" )
2018-10-24 13:20:27 +00:00
else ( )
# On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API
2019-10-31 12:56:06 +00:00
list ( APPEND deprecations "QT_DISABLE_DEPRECATED_BEFORE=0x050000" )
2018-10-24 13:20:27 +00:00
endif ( )
2019-10-31 12:56:06 +00:00
list ( APPEND deprecations "QT_DEPRECATED_WARNINGS_SINCE=0x060000" )
set ( "${result}" deprecations PARENT_SCOPE )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-12-02 10:10:05 +00:00
function ( qt_install_injections target build_dir install_dir )
2019-02-11 16:09:03 +00:00
set ( injections ${ ARGN } )
2019-12-02 10:10:05 +00:00
set ( module "Qt${target}" )
2020-01-06 12:45:34 +00:00
get_target_property ( target_type ${ target } TYPE )
if ( target_type STREQUAL "INTERFACE_LIBRARY" )
set ( is_framework FALSE )
else ( )
get_target_property ( is_framework ${ target } FRAMEWORK )
endif ( )
2019-02-11 16:09:03 +00:00
# examples:
# SYNCQT.INJECTIONS = src/corelib/global/qconfig.h:qconfig.h:QtConfig src/corelib/global/qconfig_p.h:5.12.0/QtCore/private/qconfig_p.h
# SYNCQT.INJECTIONS = src/gui/vulkan/qvulkanfunctions.h:^qvulkanfunctions.h:QVulkanFunctions:QVulkanDeviceFunctions src/gui/vulkan/qvulkanfunctions_p.h:^5.12.0/QtGui/private/qvulkanfunctions_p.h
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# The are 3 parts to the assignment, divded by colons ':'.
# The first part contains a path to a generated file in a build folder.
# The second part contains the file name that the forwarding header should have, which points
# to the file in the first part.
# The third part contains multiple UpperCaseFileNames that should be forwarding headers to the
# header specified in the second part.
2019-02-11 16:09:03 +00:00
separate_arguments ( injections UNIX_COMMAND "${injections}" )
foreach ( injection ${ injections } )
string ( REPLACE ":" ";" injection ${ injection } )
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# Part 1.
2019-02-11 16:09:03 +00:00
list ( GET injection 0 file )
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# Part 2.
2019-02-11 16:09:03 +00:00
list ( GET injection 1 destination )
string ( REGEX REPLACE "^\\^" "" destination "${destination}" )
list ( REMOVE_AT injection 0 1 )
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# Part 3.
2019-02-11 16:09:03 +00:00
set ( fwd_hdrs ${ injection } )
get_filename_component ( destinationdir ${ destination } DIRECTORY )
get_filename_component ( destinationname ${ destination } NAME )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
get_filename_component ( original_file_name ${ file } NAME )
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# This describes a concrete example for easier comprehension:
# A file 'qtqml-config.h' is generated by qt_internal_feature_write_file into
# ${qtdeclarative_build_dir}/src/{module}/qtqml-config.h (part 1).
#
# Generate a lower case forwarding header (part 2) 'qtqml-config.h' at the following
# location:
# ${some_prefix}/include/${module}/qtqml-config.h.
#
# Inside this file, we #include the originally generated file,
# ${qtdeclarative_build_dir}/src/{module}/qtqml-config.h.
#
# ${some_prefix}'s value depends on the build type.
# If doing a prefix build, it should point to
2019-06-14 13:29:21 +00:00
# ${current_repo_build_dir} which is ${qtdeclarative_build_dir}.
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# If doing a non-prefix build, it should point to
2019-06-14 13:29:21 +00:00
# ${qtbase_build_dir}.
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
#
# In the code below, ${some_prefix} == ${build_dir}.
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( lower_case_forwarding_header_path "${build_dir}/${INSTALL_INCLUDEDIR}/${module}" )
if ( destinationdir )
string ( APPEND lower_case_forwarding_header_path "/${destinationdir}" )
endif ( )
2019-06-14 13:29:21 +00:00
set ( current_repo_build_dir "${PROJECT_BINARY_DIR}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
file ( RELATIVE_PATH relpath
" $ { l o w e r _ c a s e _ f o r w a r d i n g _ h e a d e r _ p a t h } "
2019-06-14 13:29:21 +00:00
" $ { c u r r e n t _ r e p o _ b u i l d _ d i r } / $ { f i l e } " )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( main_contents "#include \" ${ relpath } \"")
file ( GENERATE OUTPUT "${lower_case_forwarding_header_path}/${original_file_name}"
C O N T E N T " $ { m a i n _ c o n t e n t s } " )
2019-12-02 10:10:05 +00:00
if ( is_framework )
if ( file MATCHES "_p\\.h$" )
set ( header_type PRIVATE )
else ( )
set ( header_type PUBLIC )
endif ( )
qt_copy_framework_headers ( ${ target } ${ header_type }
$ { c u r r e n t _ r e p o _ b u i l d _ d i r } / $ { f i l e } )
else ( )
# Copy the actual injected (generated) header file (not the just created forwarding one)
# to its install location when doing a prefix build. In an non-prefix build, the qt_install
# will be a no-op.
qt_path_join ( install_destination
$ { i n s t a l l _ d i r } $ { I N S T A L L _ I N C L U D E D I R } $ { m o d u l e } $ { d e s t i n a t i o n d i r } )
qt_install ( FILES ${ current_repo_build_dir } / ${ file }
D E S T I N A T I O N $ { i n s t a l l _ d e s t i n a t i o n }
R E N A M E $ { d e s t i n a t i o n n a m e } O P T I O N A L )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
# Generate UpperCaseNamed forwarding headers (part 3).
2019-02-11 16:09:03 +00:00
foreach ( fwd_hdr ${ fwd_hdrs } )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( upper_case_forwarding_header_path "${INSTALL_INCLUDEDIR}/${module}" )
if ( destinationdir )
string ( APPEND upper_case_forwarding_header_path "/${destinationdir}" )
endif ( )
# Generate upper case forwarding header like QVulkanFunctions or QtConfig.
file ( GENERATE OUTPUT "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}"
C O N T E N T " #include \"${destinationname}\"\n")
2019-12-02 10:10:05 +00:00
if ( is_framework )
# Copy the forwarding header to the framework's Headers directory.
qt_copy_framework_headers ( ${ target } PUBLIC
" $ { b u i l d _ d i r } / $ { u p p e r _ c a s e _ f o r w a r d i n g _ h e a d e r _ p a t h } / $ { f w d _ h d r } " )
else ( )
# Install the forwarding header.
qt_path_join ( install_destination
$ { i n s t a l l _ d i r } $ { u p p e r _ c a s e _ f o r w a r d i n g _ h e a d e r _ p a t h } )
qt_install ( FILES "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}"
D E S T I N A T I O N $ { i n s t a l l _ d e s t i n a t i o n } O P T I O N A L )
endif ( )
2019-02-11 16:09:03 +00:00
endforeach ( )
endforeach ( )
endfunction ( )
2018-12-07 13:04:42 +00:00
function ( qt_read_headers_pri target resultVarPrefix )
qt_internal_module_info ( module "${target}" )
file ( STRINGS "${module_include_dir}/headers.pri" headers_pri_contents )
2018-10-24 13:20:27 +00:00
foreach ( line ${ headers_pri_contents } )
if ( "${line}" MATCHES "SYNCQT.HEADER_FILES = (.*)" )
set ( public_module_headers "${CMAKE_MATCH_1}" )
separate_arguments ( public_module_headers UNIX_COMMAND "${public_module_headers}" )
elseif ( "${line}" MATCHES "SYNCQT.PRIVATE_HEADER_FILES = (.*)" )
set ( private_module_headers "${CMAKE_MATCH_1}" )
separate_arguments ( private_module_headers UNIX_COMMAND "${private_module_headers}" )
elseif ( "${line}" MATCHES "SYNCQT.GENERATED_HEADER_FILES = (.*)" )
set ( generated_module_headers "${CMAKE_MATCH_1}" )
separate_arguments ( generated_module_headers UNIX_COMMAND "${generated_module_headers}" )
foreach ( generated_header ${ generated_module_headers } )
2018-12-07 13:04:42 +00:00
list ( APPEND public_module_headers "${module_include_dir}/${generated_header}" )
2018-10-24 13:20:27 +00:00
endforeach ( )
2019-02-11 16:09:03 +00:00
elseif ( "${line}" MATCHES "SYNCQT.INJECTIONS = (.*)" )
set ( injections "${CMAKE_MATCH_1}" )
2018-10-24 13:20:27 +00:00
elseif ( "${line}" MATCHES "SYNCQT.([A-Z_]+)_HEADER_FILES = (.+)" )
set ( prefix "${CMAKE_MATCH_1}" )
string ( TOLOWER "${prefix}" prefix )
set ( entries "${CMAKE_MATCH_2}" )
separate_arguments ( entries UNIX_COMMAND "${entries}" )
set ( "${resultVarPrefix}_${prefix}" "${entries}" PARENT_SCOPE )
endif ( )
endforeach ( )
set ( ${ resultVarPrefix } _public "${public_module_headers}" PARENT_SCOPE )
set ( ${ resultVarPrefix } _private "${private_module_headers}" PARENT_SCOPE )
2019-02-11 16:09:03 +00:00
set ( ${ resultVarPrefix } _injections "${injections}" PARENT_SCOPE )
2018-10-24 13:20:27 +00:00
endfunction ( )
2018-12-07 12:48:36 +00:00
# Add Qt::target and Qt6::target as aliases for the target
function ( qt_internal_add_target_aliases target )
get_target_property ( type "${target}" TYPE )
if ( type STREQUAL EXECUTABLE )
add_executable ( "Qt::${target}" ALIAS "${target}" )
add_executable ( "Qt${PROJECT_VERSION_MAJOR}::${target}" ALIAS "${target}" )
else ( )
add_library ( "Qt::${target}" ALIAS "${target}" )
add_library ( "Qt${PROJECT_VERSION_MAJOR}::${target}" ALIAS "${target}" )
endif ( )
endfunction ( )
2019-06-04 13:55:41 +00:00
# Sets the exceptions flags for the given target
function ( qt_internal_set_no_exceptions_flags target )
target_compile_definitions ( "${target}" PRIVATE "QT_NO_EXCEPTIONS" )
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" )
2019-06-06 14:18:37 +00:00
target_compile_options ( "${target}" PRIVATE "/wd4530" "/wd4577" )
2019-06-04 13:55:41 +00:00
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
target_compile_options ( "${target}" PRIVATE "-fno-exceptions" )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" )
target_compile_options ( "${target}" PRIVATE "-fno-exceptions" )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
target_compile_options ( "${target}" PRIVATE "-fno-exceptions" )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
target_compile_options ( "${target}" PRIVATE "-fno-exceptions" )
endif ( )
endfunction ( )
2018-12-07 12:48:36 +00:00
2019-10-15 09:10:08 +00:00
function ( qt_skip_warnings_are_errors target )
2019-11-13 13:46:10 +00:00
get_target_property ( target_type "${target}" TYPE )
if ( target_type STREQUAL "INTERFACE_LIBRARY" )
return ( )
endif ( )
2019-10-15 09:10:08 +00:00
set_target_properties ( "${target}" PROPERTIES QT_SKIP_WARNINGS_ARE_ERRORS ON )
endfunction ( )
function ( qt_skip_warnings_are_errors_when_repo_unclean target )
if ( QT_REPO_NOT_WARNINGS_CLEAN )
qt_skip_warnings_are_errors ( "${target}" )
endif ( )
endfunction ( )
2019-11-15 14:43:20 +00:00
function ( qt_get_sanitized_plugin_type plugin_type out_var )
# Used to handle some edge cases such as platforms/darwin
string ( REGEX REPLACE "[-/]" "_" plugin_type "${plugin_type}" )
set ( "${out_var}" "${plugin_type}" PARENT_SCOPE )
endfunction ( )
2019-12-02 10:10:05 +00:00
# Copy header files to QtXYZ.framework/Versions/6/Headers/
# Use this function for header files that
# - are not added as source files to the target
# - are not marked as PUBLIC_HEADER
# - or are private and supposed to end up in the 6.7.8/QtXYZ/private subdir.
function ( qt_copy_framework_headers target )
get_target_property ( is_fw ${ target } FRAMEWORK )
if ( NOT "${is_fw}" )
return ( )
endif ( )
set ( options PUBLIC PRIVATE QPA )
set ( oneValueArgs )
set ( multiValueArgs )
cmake_parse_arguments ( ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ ARGN } )
get_target_property ( fw_version ${ target } FRAMEWORK_VERSION )
get_target_property ( fw_bundle_version ${ target } MACOSX_FRAMEWORK_BUNDLE_VERSION )
get_target_property ( fw_dir ${ target } LIBRARY_OUTPUT_DIRECTORY )
get_target_property ( fw_name ${ target } OUTPUT_NAME )
set ( fw_headers_dir ${ fw_dir } / ${ fw_name } .framework/Versions/ ${ fw_version } /Headers/ )
if ( ARG_PRIVATE )
string ( APPEND fw_headers_dir "${fw_bundle_version}/Qt${target}/private/" )
elseif ( ARG_QPA )
string ( APPEND fw_headers_dir "${fw_bundle_version}/Qt${target}/qpa/" )
endif ( )
set ( out_files )
foreach ( hdr IN LISTS ARG_UNPARSED_ARGUMENTS )
get_filename_component ( in_file_path ${ hdr } ABSOLUTE )
get_filename_component ( in_file_name ${ hdr } NAME )
set ( out_file_path ${ fw_headers_dir } ${ in_file_name } )
add_custom_command (
O U T P U T $ { o u t _ f i l e _ p a t h }
D E P E N D S $ { i n _ f i l e _ p a t h }
C O M M A N D $ { C M A K E _ C O M M A N D } - E m a k e _ d i r e c t o r y " $ { f w _ h e a d e r s _ d i r } "
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y " $ { i n _ f i l e _ p a t h } " " $ { f w _ h e a d e r s _ d i r } " )
list ( APPEND out_files ${ out_file_path } )
endforeach ( )
get_target_property ( fw_copied_headers ${ target } QT_COPIED_FRAMEWORK_HEADERS )
if ( NOT fw_copied_headers )
set ( fw_copied_headers "" )
endif ( )
list ( APPEND fw_copied_headers ${ out_files } )
set_target_properties ( ${ target } PROPERTIES QT_COPIED_FRAMEWORK_HEADERS "${fw_copied_headers}" )
endfunction ( )
function ( qt_finalize_framework_headers_copy target )
get_target_property ( target_type ${ target } TYPE )
if ( ${ target_type } STREQUAL "INTERFACE_LIBRARY" )
return ( )
endif ( )
get_target_property ( is_fw ${ target } FRAMEWORK )
if ( NOT "${is_fw}" )
return ( )
endif ( )
get_target_property ( headers ${ target } QT_COPIED_FRAMEWORK_HEADERS )
if ( headers )
# Hack to create the "Headers" symlink in the framework:
# Create a fake header file and copy it into the framework by marking it as PUBLIC_HEADER.
# CMake now takes care of creating the symlink.
set ( fake_header ${ target } _fake_header.h )
2019-12-06 14:12:17 +00:00
qt_get_main_cmake_configuration ( main_config )
file ( GENERATE OUTPUT ${ fake_header } CONTENT "// ignore this file\n"
C O N D I T I O N " $ < C O N F I G : $ { m a i n _ c o n f i g } > " )
2019-12-02 10:10:05 +00:00
string ( PREPEND fake_header "${CMAKE_CURRENT_BINARY_DIR}/" )
target_sources ( ${ target } PRIVATE ${ fake_header } )
set_source_files_properties ( ${ fake_header } PROPERTIES GENERATED ON )
set_property ( TARGET ${ target } APPEND PROPERTY PUBLIC_HEADER ${ fake_header } )
# Add a target, e.g. Core_framework_headers, that triggers the header copy.
add_custom_target ( ${ target } _framework_headers DEPENDS ${ headers } )
add_dependencies ( ${ target } ${ target } _framework_headers )
endif ( )
endfunction ( )
2019-12-06 14:12:17 +00:00
function ( qt_clone_property_for_configs target property configs )
get_target_property ( value "${target}" "${property}" )
foreach ( config ${ configs } )
string ( TOUPPER "${config}" upper_config )
set_property ( TARGET "${target}" PROPERTY "${property}_${upper_config}" "${value}" )
endforeach ( )
endfunction ( )
function ( qt_handle_multi_config_output_dirs target )
set ( possible_configs "${CMAKE_BUILD_TYPE}" )
if ( CMAKE_CONFIGURATION_TYPES )
set ( possible_configs "${CMAKE_CONFIGURATION_TYPES}" )
endif ( )
qt_clone_property_for_configs ( ${ target } LIBRARY_OUTPUT_DIRECTORY "${possible_configs}" )
qt_clone_property_for_configs ( ${ target } RUNTIME_OUTPUT_DIRECTORY "${possible_configs}" )
qt_clone_property_for_configs ( ${ target } ARCHIVE_OUTPUT_DIRECTORY "${possible_configs}" )
endfunction ( )
2018-10-24 13:20:27 +00:00
# This is the main entry function for creating a Qt module, that typically
# consists of a library, public header files, private header files and configurable
# features.
#
2018-12-07 12:30:51 +00:00
# A CMake target with the specified target parameter is created. If the current source
2018-10-24 13:20:27 +00:00
# directory has a configure.cmake file, then that is also processed for feature definition
# and testing. Any features defined as well as any features coming from dependencies to
# this module are imported into the scope of the calling feature.
2018-12-07 12:30:51 +00:00
#
# Target is without leading "Qt". So e.g. the "QtCore" module has the target "Core".
2019-11-13 13:03:20 +00:00
function ( qt_add_module target )
2018-12-07 13:04:42 +00:00
qt_internal_module_info ( module "${target}" )
# Process arguments:
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_module"
2019-11-26 09:10:55 +00:00
" N O _ M O D U L E _ H E A D E R S ; S T A T I C ; D I S A B L E _ T O O L S _ E X P O R T ; E X C E P T I O N S ; I N T E R N A L _ M O D U L E ; N O _ S Y N C _ Q T ; N O _ P R I V A T E _ M O D U L E ; H E A D E R _ M O D U L E ; G E N E R A T E _ M E T A T Y P E S "
2019-07-05 08:47:26 +00:00
" C O N F I G _ M O D U L E _ N A M E ; P R E C O M P I L E D _ H E A D E R "
2020-01-31 21:21:09 +00:00
" $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } ; $ { _ _ d e f a u l t _ p r i v a t e _ m o d u l e _ a r g s } ; Q M A K E _ M O D U L E _ C O N F I G ; E X T R A _ C M A K E _ F I L E S ; E X T R A _ C M A K E _ I N C L U D E S ; N O _ P C H _ S O U R C E S " $ { A R G N } )
2018-10-24 13:20:27 +00:00
2018-12-07 13:04:42 +00:00
if ( NOT DEFINED arg_CONFIG_MODULE_NAME )
set ( arg_CONFIG_MODULE_NAME "${module_lower}" )
endif ( )
2018-10-24 13:20:27 +00:00
2019-08-20 13:24:14 +00:00
qt_internal_add_qt_repo_known_module ( "${target}" )
2018-10-24 13:20:27 +00:00
### Define Targets:
2019-12-02 10:10:05 +00:00
set ( is_interface_lib 0 )
2019-08-19 13:07:22 +00:00
if ( ${ arg_HEADER_MODULE } )
add_library ( "${target}" INTERFACE )
2019-12-02 10:10:05 +00:00
set ( is_interface_lib 1 )
2019-08-19 13:07:22 +00:00
elseif ( ${ arg_STATIC } )
2018-10-24 13:20:27 +00:00
add_library ( "${target}" STATIC )
elseif ( ${ QT_BUILD_SHARED_LIBS } )
add_library ( "${target}" SHARED )
else ( )
add_library ( "${target}" STATIC )
endif ( )
2019-08-30 09:34:23 +00:00
2019-12-02 10:10:05 +00:00
set ( is_framework 0 )
if ( QT_FEATURE_framework AND NOT ${ arg_HEADER_MODULE } AND NOT ${ arg_STATIC } )
set ( is_framework 1 )
set_target_properties ( ${ target } PROPERTIES
F R A M E W O R K T R U E
F R A M E W O R K _ V E R S I O N $ { P R O J E C T _ V E R S I O N _ M A J O R }
M A C O S X _ F R A M E W O R K _ I D E N T I F I E R o r g . q t - p r o j e c t . Q t $ { t a r g e t }
M A C O S X _ F R A M E W O R K _ B U N D L E _ V E R S I O N $ { P R O J E C T _ V E R S I O N }
M A C O S X _ F R A M E W O R K _ S H O R T _ V E R S I O N _ S T R I N G $ { P R O J E C T _ V E R S I O N _ M A J O R } . $ { P R O J E C T _ V E R S I O N _ M I N O R }
)
endif ( )
2019-10-14 13:18:50 +00:00
if ( ANDROID )
2019-08-30 09:34:23 +00:00
qt_android_apply_arch_suffix ( "${target}" )
endif ( )
2018-12-07 12:48:36 +00:00
qt_internal_add_target_aliases ( "${target}" )
2019-10-15 09:10:08 +00:00
qt_skip_warnings_are_errors_when_repo_unclean ( "${target}" )
2018-10-24 13:20:27 +00:00
# Add _private target to link against the private headers:
2019-08-19 13:07:22 +00:00
if ( NOT ${ arg_NO_PRIVATE_MODULE } )
set ( target_private "${target}Private" )
add_library ( "${target_private}" INTERFACE )
qt_internal_add_target_aliases ( "${target_private}" )
endif ( )
2018-10-24 13:20:27 +00:00
2019-12-02 10:10:05 +00:00
if ( NOT arg_HEADER_MODULE )
set_target_properties ( ${ target } PROPERTIES
L I B R A R Y _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ L I B D I R } "
R U N T I M E _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ B I N D I R } "
A R C H I V E _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ L I B D I R } "
V E R S I O N $ { P R O J E C T _ V E R S I O N }
S O V E R S I O N $ { P R O J E C T _ V E R S I O N _ M A J O R }
)
2019-12-06 14:12:17 +00:00
qt_handle_multi_config_output_dirs ( "${target}" )
2019-12-02 10:10:05 +00:00
if ( is_framework )
set_target_properties ( ${ target } PROPERTIES
O U T P U T _ N A M E Q t $ { t a r g e t }
)
else ( )
set_target_properties ( ${ target } PROPERTIES
O U T P U T _ N A M E " $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } "
)
endif ( )
endif ( )
2018-12-11 10:38:20 +00:00
# Module headers:
2019-06-07 08:51:55 +00:00
if ( ${ arg_NO_MODULE_HEADERS } OR ${ arg_NO_SYNC_QT } )
2019-08-19 13:07:22 +00:00
set_target_properties ( "${target}" PROPERTIES INTERFACE_MODULE_HAS_HEADERS OFF )
2018-12-07 12:48:36 +00:00
else ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
# Use QT_BUILD_DIR for the syncqt call.
# So we either write the generated files into the qtbase non-prefix build root, or the
# module specific build root.
2018-12-07 13:04:42 +00:00
qt_ensure_sync_qt ( )
Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.
But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.
Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.
Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
#include <QtQml/QQmlEngine>
work correctly.
Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.
Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-24 17:19:51 +00:00
set ( syncqt_full_command "${HOST_PERL}" -w "${QT_SYNCQT}"
- q u i e t
- c h e c k - i n c l u d e s
- m o d u l e " $ { m o d u l e } "
- v e r s i o n " $ { P R O J E C T _ V E R S I O N } "
- o u t d i r " $ { Q T _ B U I L D _ D I R } "
- b u i l d d i r " $ { P R O J E C T _ B I N A R Y _ D I R } "
" $ { P R O J E C T _ S O U R C E _ D I R } " )
execute_process ( COMMAND ${ syncqt_full_command } )
2018-10-24 13:20:27 +00:00
2019-08-19 13:07:22 +00:00
set_target_properties ( "${target}" PROPERTIES INTERFACE_MODULE_HAS_HEADERS ON )
2018-12-11 10:38:20 +00:00
### FIXME: Can we replace headers.pri?
qt_read_headers_pri ( "${target}" "module_headers" )
2019-12-02 10:10:05 +00:00
set ( module_depends_header "${module_include_dir}/${module}Depends" )
if ( is_framework )
if ( NOT is_interface_lib )
set ( public_headers_to_copy "${module_headers_public}" "${module_depends_header}" )
qt_copy_framework_headers ( ${ target } PUBLIC "${public_headers_to_copy}" )
qt_copy_framework_headers ( ${ target } PRIVATE "${module_headers_private}" )
endif ( )
else ( )
set_property ( TARGET ${ target } APPEND PROPERTY PUBLIC_HEADER "${module_headers_public}" )
set_property ( TARGET ${ target } APPEND PROPERTY PUBLIC_HEADER ${ module_depends_header } )
set_property ( TARGET ${ target } APPEND PROPERTY PRIVATE_HEADER "${module_headers_private}" )
endif ( )
2019-09-13 08:35:29 +00:00
if ( NOT ${ arg_HEADER_MODULE } )
set_property ( TARGET "${target}" PROPERTY MODULE_HEADER "${module_include_dir}/${module}" )
endif ( )
2019-07-05 08:47:26 +00:00
2019-06-20 08:13:22 +00:00
if ( module_headers_qpa )
2019-12-02 10:10:05 +00:00
if ( is_framework )
qt_copy_framework_headers ( ${ target } QPA "${module_headers_qpa}" )
else ( )
qt_install (
F I L E S $ { m o d u l e _ h e a d e r s _ q p a }
D E S T I N A T I O N $ { I N S T A L L _ I N C L U D E D I R } / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } / q p a )
endif ( )
2019-06-20 08:13:22 +00:00
endif ( )
2018-10-24 13:20:27 +00:00
endif ( )
2019-08-19 13:07:22 +00:00
if ( NOT arg_HEADER_MODULE )
2019-11-21 12:33:28 +00:00
# This property is used for super builds with static libraries. We use
# it in QtPlugins.cmake.in to avoid "polluting" the dependency chain
# for the target in it's project directory.
# E.g: When we process find_package(Qt6 ... Gui) in QtDeclarative, the
# rules in QtPugins.cmake add all the known Gui plugins as interface
# dependencies. This in turn causes circular dependencies on every
# plugin which links against Gui. Plugin A -> GUI -> Plugin A ....
set_target_properties ( ${ target } PROPERTIES QT_BUILD_PROJECT_NAME ${ PROJECT_NAME } )
2019-08-19 13:07:22 +00:00
# Plugin types associated to a module
if ( NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x" )
2019-09-23 14:57:06 +00:00
# Reset the variable containing the list of plugins for the given plugin type
foreach ( plugin_type ${ arg_PLUGIN_TYPES } )
2019-11-15 14:43:20 +00:00
qt_get_sanitized_plugin_type ( "${plugin_type}" plugin_type )
2019-09-23 14:57:06 +00:00
set_property ( TARGET "${target}" APPEND PROPERTY MODULE_PLUGIN_TYPES "${plugin_type}" )
qt_internal_add_qt_repo_known_plugin_types ( "${plugin_type}" )
endforeach ( )
2019-08-19 13:07:22 +00:00
endif ( )
endif ( )
2018-10-24 13:20:27 +00:00
qt_internal_library_deprecation_level ( deprecation_define )
2019-08-19 13:07:22 +00:00
if ( NOT arg_HEADER_MODULE )
qt_autogen_tools_initial_setup ( ${ target } )
endif ( )
2019-03-06 12:51:38 +00:00
2019-08-08 14:55:48 +00:00
set ( private_includes
2019-09-05 13:22:14 +00:00
" $ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } > "
" $ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } > "
2019-08-08 14:55:48 +00:00
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
2019-06-05 08:51:45 +00:00
)
2019-08-08 14:55:48 +00:00
2019-09-02 09:26:12 +00:00
set ( public_includes "" )
2019-12-02 10:10:05 +00:00
set ( public_headers_list "public_includes" )
if ( is_framework )
set ( public_headers_list "private_includes" )
set ( fw_bundle_subdir "${INSTALL_LIBDIR}/Qt${target}.framework" )
set ( fw_headers_subdir "Versions/${PROJECT_VERSION_MAJOR}/Headers" )
list ( APPEND public_includes
# Add the lib/Foo.framework dir as include path to let CMake generate
# the -F compiler flag.
" $ < B U I L D _ I N T E R F A C E : $ { Q T _ B U I L D _ D I R } / $ { f w _ b u n d l e _ s u b d i r } > "
" $ < I N S T A L L _ I N T E R F A C E : $ { f w _ b u n d l e _ s u b d i r } > "
# Add the fully resolved Headers subdir, because the Headers symlink might
# not be there yet.
" $ < B U I L D _ I N T E R F A C E : $ { Q T _ B U I L D _ D I R } / $ { f w _ b u n d l e _ s u b d i r } / $ { f w _ h e a d e r s _ s u b d i r } > "
# After installing, the Headers symlink is guaranteed to exist.
" $ < I N S T A L L _ I N T E R F A C E : $ { f w _ b u n d l e _ s u b d i r } / H e a d e r s > "
)
endif ( )
2019-09-02 09:26:12 +00:00
# Handle cases like QmlDevTools which do not have their own headers, but rather borrow them
# from another module.
2019-10-14 13:47:53 +00:00
if ( NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS )
2019-12-03 15:07:44 +00:00
# Don't include private headers unless they exist, aka syncqt created them.
if ( module_headers_private )
list ( APPEND private_includes
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ i n c l u d e _ d i r } / $ { P R O J E C T _ V E R S I O N } > "
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ i n c l u d e _ d i r } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } > " )
endif ( )
2019-09-02 09:26:12 +00:00
2019-12-02 10:10:05 +00:00
list ( APPEND ${ public_headers_list }
2019-09-02 09:26:12 +00:00
# For the syncqt headers
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ r e p o _ i n c l u d e _ d i r } > "
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ i n c l u d e _ d i r } > " )
endif ( )
2019-08-08 14:55:48 +00:00
2019-09-10 12:02:15 +00:00
if ( NOT arg_NO_MODULE_HEADERS AND NOT arg_NO_SYNC_QT )
2019-08-08 14:55:48 +00:00
# For the syncqt headers
2020-01-26 11:25:40 +00:00
list ( APPEND ${ public_headers_list } "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}/${module}>" )
2019-06-05 08:51:45 +00:00
endif ( )
2019-12-02 10:10:05 +00:00
list ( APPEND ${ public_headers_list } ${ arg_PUBLIC_INCLUDE_DIRECTORIES } )
2019-06-05 08:51:45 +00:00
2019-08-19 13:07:22 +00:00
set ( header_module )
if ( arg_HEADER_MODULE )
set ( header_module "HEADER_MODULE" )
endif ( )
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${target}"
2019-08-19 13:07:22 +00:00
$ { h e a d e r _ m o d u l e }
2018-12-07 12:13:24 +00:00
S O U R C E S $ { a r g _ S O U R C E S }
2018-10-24 13:20:27 +00:00
I N C L U D E _ D I R E C T O R I E S
2019-08-08 14:55:48 +00:00
$ { p r i v a t e _ i n c l u d e s }
P U B L I C _ I N C L U D E _ D I R E C T O R I E S
$ { p u b l i c _ i n c l u d e s }
2018-10-24 13:20:27 +00:00
P U B L I C _ D E F I N E S
2018-12-07 12:13:24 +00:00
$ { a r g _ P U B L I C _ D E F I N E S }
2019-06-05 09:31:55 +00:00
Q T _ $ { m o d u l e _ d e f i n e } _ L I B
2018-10-24 13:20:27 +00:00
D E F I N E S
2018-12-07 12:13:24 +00:00
$ { a r g _ D E F I N E S }
2018-10-24 13:20:27 +00:00
Q T _ N O _ C A S T _ T O _ A S C I I Q T _ A S C I I _ C A S T _ W A R N I N G S
Q T _ M O C _ C O M P A T #we don't need warnings from calling moc code in our generated code
Q T _ U S E _ Q S T R I N G B U I L D E R
Q T _ D E P R E C A T E D _ W A R N I N G S
Q T _ B U I L D I N G _ Q T
2019-06-05 09:31:55 +00:00
Q T _ B U I L D _ $ { m o d u l e _ d e f i n e } _ L I B ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
2018-10-24 13:20:27 +00:00
" $ { d e p r e c a t i o n _ d e f i n e } "
2018-12-11 10:38:20 +00:00
P U B L I C _ L I B R A R I E S $ { a r g _ P U B L I C _ L I B R A R I E S }
2019-06-05 14:05:50 +00:00
L I B R A R I E S $ { a r g _ L I B R A R I E S } Q t : : P l a t f o r m M o d u l e I n t e r n a l
2020-01-31 21:21:09 +00:00
P R I V A T E _ M O D U L E _ I N T E R F A C E $ { a r g _ P R I V A T E _ M O D U L E _ I N T E R F A C E }
2018-12-11 10:38:20 +00:00
F E A T U R E _ D E P E N D E N C I E S $ { a r g _ F E A T U R E _ D E P E N D E N C I E S }
D B U S _ A D A P T O R _ S O U R C E S $ { a r g _ D B U S _ A D A P T O R _ S O U R C E S }
D B U S _ A D A P T O R _ F L A G S $ { a r g _ D B U S _ A D A P T O R _ F L A G S }
D B U S _ I N T E R F A C E _ S O U R C E S $ { a r g _ D B U S _ I N T E R F A C E _ S O U R C E S }
D B U S _ I N T E R F A C E _ F L A G S $ { a r g _ D B U S _ I N T E R F A C E _ F L A G S }
2019-01-29 11:07:24 +00:00
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
P U B L I C _ C O M P I L E _ O P T I O N S $ { a r g _ P U B L I C _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
P U B L I C _ L I N K _ O P T I O N S $ { a r g _ P U B L I C _ L I N K _ O P T I O N S }
2019-01-30 15:43:11 +00:00
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
2019-05-22 13:09:39 +00:00
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
2019-07-05 08:47:26 +00:00
P R E C O M P I L E D _ H E A D E R $ { a r g _ P R E C O M P I L E D _ H E A D E R }
N O _ P C H _ S O U R C E S $ { a r g _ N O _ P C H _ S O U R C E S }
2018-10-24 13:20:27 +00:00
)
2019-08-19 13:07:22 +00:00
if ( NOT ${ arg_EXCEPTIONS } AND NOT ${ arg_HEADER_MODULE } )
2019-06-04 13:55:41 +00:00
qt_internal_set_no_exceptions_flags ( "${target}" )
endif ( )
2019-06-03 15:41:45 +00:00
2018-12-11 10:38:20 +00:00
set ( configureFile "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake" )
if ( EXISTS "${configureFile}" )
qt_feature_module_begin (
L I B R A R Y " $ { t a r g e t } "
P U B L I C _ F I L E " q t $ { a r g _ C O N F I G _ M O D U L E _ N A M E } - c o n f i g . h "
P R I V A T E _ F I L E " q t $ { a r g _ C O N F I G _ M O D U L E _ N A M E } - c o n f i g _ p . h "
P U B L I C _ D E P E N D E N C I E S $ { a r g _ F E A T U R E _ D E P E N D E N C I E S }
P R I V A T E _ D E P E N D E N C I E S $ { a r g _ F E A T U R E _ D E P E N D E N C I E S }
)
include ( ${ configureFile } )
qt_feature_module_end ( "${target}" )
set_property ( TARGET "${target}" APPEND PROPERTY PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/qt${arg_CONFIG_MODULE_NAME}-config.h" )
set_property ( TARGET "${target}" APPEND PROPERTY PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/qt${arg_CONFIG_MODULE_NAME}-config_p.h" )
2018-10-24 13:20:27 +00:00
endif ( )
2019-11-04 12:53:35 +00:00
if ( NOT arg_HEADER_MODULE )
if ( DEFINED module_headers_private )
qt_internal_add_linker_version_script ( "${target}" PRIVATE_HEADERS ${ module_headers_private } ${ module_headers_qpa } )
else ( )
qt_internal_add_linker_version_script ( "${target}" )
endif ( )
2018-10-24 13:20:27 +00:00
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
# Handle injections. Aka create forwarding headers for certain headers that have been
# automatically generated in the build dir (for example qconfig.h, qtcore-config.h,
# qvulkanfunctions.h, etc)
# module_headers_injections come from the qt_read_headers_pri() call.
# extra_library_injections come from the qt_feature_module_end() call.
set ( final_injections "" )
if ( module_headers_injections )
string ( APPEND final_injections "${module_headers_injections} " )
endif ( )
if ( extra_library_injections )
string ( APPEND final_injections "${extra_library_injections} " )
endif ( )
2018-10-24 13:20:27 +00:00
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
if ( final_injections )
2019-12-02 10:10:05 +00:00
qt_install_injections ( ${ target } "${QT_BUILD_DIR}" "${QT_INSTALL_DIR}" ${ final_injections } )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
endif ( )
# Handle creation of cmake files for consumers of find_package().
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 } )
2019-05-03 10:30:09 +00:00
2019-02-12 11:21:56 +00:00
set ( extra_cmake_files )
set ( extra_cmake_includes )
if ( EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake" )
list ( APPEND extra_cmake_files "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake" )
list ( APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake" )
endif ( )
if ( EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in" )
configure_file ( "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in"
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g E x t r a s . c m a k e "
2019-02-12 11:21:56 +00:00
@ O N L Y )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
list ( APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake" )
2019-02-12 11:21:56 +00:00
list ( APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake" )
endif ( )
2019-08-19 14:19:08 +00:00
foreach ( cmake_file IN LISTS arg_EXTRA_CMAKE_FILES )
get_filename_component ( basename ${ cmake_file } NAME )
file ( COPY ${ cmake_file } DESTINATION ${ config_build_dir } )
list ( APPEND extra_cmake_files "${config_build_dir}/${basename}" )
endforeach ( )
list ( APPEND extra_cmake_includes ${ arg_EXTRA_CMAKE_INCLUDES } )
2019-05-03 14:03:15 +00:00
set ( extra_cmake_code "" )
2019-05-16 09:34:06 +00:00
2019-05-03 14:03:15 +00:00
if ( target STREQUAL Core )
# Propagate non-build related variables that are needed for consuming Qt packages.
2019-06-14 10:59:07 +00:00
# Do this in CoreConfig instead of Qt6Config, so that consumers can also use
# find_package(Qt6Core) instead of find_package(Qt6 COMPONENTS Core)
2019-05-03 14:03:15 +00:00
string ( APPEND extra_cmake_code "
2019-05-16 09:34:06 +00:00
set ( QT_CMAKE_EXPORT_NAMESPACE ${ QT_CMAKE_EXPORT_NAMESPACE } ) " )
2019-05-03 14:03:15 +00:00
endif ( )
2019-05-16 09:34:06 +00:00
2020-01-27 13:56:40 +00:00
# Generate metatypes
set ( QT_MODULE_HAS_META_TYPES_FILE FALSE )
if ( ${ arg_GENERATE_METATYPES } )
set ( QT_MODULE_HAS_META_TYPES_FILE TRUE )
set ( metatypes_install_dir ${ INSTALL_LIBDIR } /metatypes )
set ( args )
if ( NOT QT_WILL_INSTALL )
set ( args COPY_OVER_INSTALL INSTALL_DIR "${QT_BUILD_DIR}/${metatypes_install_dir}" )
else ( )
set ( args INSTALL_DIR "${metatypes_install_dir}" )
endif ( )
qt6_generate_meta_types_json_file ( ${ target } ${ args } )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
configure_package_config_file (
" $ { Q T _ C M A K E _ D I R } / Q t M o d u l e C o n f i g . c m a k e . i n "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g . c m a k e "
I N S T A L L _ D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
2020-02-05 16:35:49 +00:00
if ( EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake" )
configure_file ( "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake"
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } B u i l d I n t e r n a l s . c m a k e "
@ O N L Y )
list ( APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake" )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
write_basic_package_version_file (
2019-05-03 14:03:15 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
)
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g . c m a k e "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
$ { e x t r a _ c m a k e _ f i l e s }
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
2019-06-06 12:29:31 +00:00
file ( COPY ${ extra_cmake_files } DESTINATION "${config_build_dir}" )
2019-08-19 13:07:22 +00:00
set ( exported_targets ${ target } )
if ( NOT ${ arg_NO_PRIVATE_MODULE } )
list ( APPEND exported_targets ${ target_private } )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets" )
qt_install ( TARGETS ${ exported_targets }
E X P O R T $ { e x p o r t _ n a m e }
2019-06-04 11:40:57 +00:00
R U N T I M E D E S T I N A T I O N $ { I N S T A L L _ B I N D I R }
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
L I B R A R Y D E S T I N A T I O N $ { I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { I N S T A L L _ L I B D I R }
2019-12-02 10:10:05 +00:00
F R A M E W O R K D E S T I N A T I O N $ { I N S T A L L _ L I B D I R }
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
P U B L I C _ H E A D E R D E S T I N A T I O N $ { I N S T A L L _ I N C L U D E D I R } / $ { m o d u l e }
P R I V A T E _ H E A D E R D E S T I N A T I O N $ { I N S T A L L _ I N C L U D E D I R } / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } / p r i v a t e
)
2019-06-24 12:54:40 +00:00
2019-11-04 13:42:59 +00:00
if ( ANDROID AND NOT arg_HEADER_MODULE )
2019-06-24 12:54:40 +00:00
# Record install library location so it can be accessed by
# qt_android_dependencies without having to specify it again.
set_target_properties ( ${ target } PROPERTIES
Q T _ A N D R O I D _ M O D U L E _ I N S T A L L _ D I R $ { I N S T A L L _ L I B D I R } )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( EXPORT ${ export_name }
N A M E S P A C E $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : :
D E S T I N A T I O N $ { c o n f i g _ i n s t a l l _ d i r } )
qt_internal_export_modern_cmake_config_targets_file (
T A R G E T S $ { e x p o r t e d _ t a r g e t s }
E X P O R T _ N A M E _ P R E F I X $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t }
C O N F I G _ I N S T A L L _ D I R " $ { c o n f i g _ i n s t a l l _ d i r } " )
2019-06-05 11:49:08 +00:00
if ( ${ arg_INTERNAL_MODULE } )
set ( arg_INTERNAL_MODULE "INTERNAL_MODULE" )
else ( )
unset ( arg_INTERNAL_MODULE )
endif ( )
2020-01-15 22:01:16 +00:00
qt_path_join ( pri_target_path ${ PROJECT_BINARY_DIR } ${ INSTALL_MKSPECSDIR } /modules )
2019-06-05 11:49:08 +00:00
qt_generate_module_pri_file ( "${target}" "${pri_target_path}" module_pri_files
$ { a r g _ I N T E R N A L _ M O D U L E }
2019-08-19 13:07:22 +00:00
$ { h e a d e r _ m o d u l e }
2019-05-29 14:56:49 +00:00
Q M A K E _ M O D U L E _ C O N F I G
$ { a r g _ Q M A K E _ M O D U L E _ C O N F I G }
)
2020-01-15 22:01:16 +00:00
qt_install ( FILES "${module_pri_files}" DESTINATION ${ INSTALL_MKSPECSDIR } /modules )
2019-05-29 14:56:49 +00:00
2018-10-24 13:20:27 +00:00
### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
# that belong to Qt.
2019-08-19 13:07:22 +00:00
if ( NOT arg_HEADER_MODULE )
qt_internal_add_link_flags_no_undefined ( "${target}" )
endif ( )
2018-10-24 13:20:27 +00:00
2019-09-02 09:26:12 +00:00
set ( interface_includes "" )
2019-02-12 19:17:57 +00:00
2019-09-02 09:26:12 +00:00
# Handle cases like QmlDevTools which do not have their own headers, but rather borrow them
# from another module.
if ( NOT arg_NO_SYNC_QT )
2020-02-06 12:04:45 +00:00
list ( APPEND interface_includes "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" )
2019-09-02 09:26:12 +00:00
if ( NOT arg_NO_MODULE_HEADERS )
2020-02-06 12:04:45 +00:00
list ( APPEND interface_includes
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ i n c l u d e _ d i r } / $ { P R O J E C T _ V E R S I O N } > "
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ i n c l u d e _ d i r } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } > " )
2019-12-02 10:10:05 +00:00
if ( is_framework )
set ( fw_headers_dir
" $ { I N S T A L L _ L I B D I R } / $ { m o d u l e } . f r a m e w o r k / H e a d e r s / " )
list ( APPEND interface_includes
" $ < I N S T A L L _ I N T E R F A C E : $ { f w _ h e a d e r s _ d i r } $ { P R O J E C T _ V E R S I O N } > "
" $ < I N S T A L L _ I N T E R F A C E : $ { f w _ h e a d e r s _ d i r } $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } > " )
else ( )
list ( APPEND interface_includes
2020-01-26 11:25:40 +00:00
" $ < I N S T A L L _ I N T E R F A C E : $ { I N S T A L L _ I N C L U D E D I R } / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } > "
" $ < I N S T A L L _ I N T E R F A C E : $ { I N S T A L L _ I N C L U D E D I R } / $ { m o d u l e } / $ { P R O J E C T _ V E R S I O N } / $ { m o d u l e } > " )
2019-12-02 10:10:05 +00:00
endif ( )
2019-09-02 09:26:12 +00:00
endif ( )
2019-06-05 08:51:45 +00:00
endif ( )
2019-08-19 13:07:22 +00:00
if ( NOT ${ arg_NO_PRIVATE_MODULE } )
target_include_directories ( "${target_private}" INTERFACE ${ interface_includes } )
endif ( )
2019-09-24 09:42:15 +00:00
2019-12-02 10:10:05 +00:00
if ( is_framework AND NOT is_interface_lib )
qt_finalize_framework_headers_copy ( ${ target } )
endif ( )
2019-09-24 09:42:15 +00:00
qt_describe_module ( ${ target } )
2019-11-26 09:10:55 +00:00
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
endfunction ( )
function ( qt_export_tools module_name )
# If no tools were defined belonging to this module, don't create a config and targets file.
2019-09-21 19:22:09 +00:00
# Guards against the case when doing a cross-build.
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
2019-06-24 13:01:53 +00:00
if ( NOT "${module_name}" IN_LIST QT_KNOWN_MODULES_WITH_TOOLS OR CMAKE_CROSSCOMPILING )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
return ( )
endif ( )
# The tools target name. For example: CoreTools
set ( target "${module_name}Tools" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
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 } )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
# Add the extra cmake statements to make the tool targets global, so it doesn't matter where
# find_package is called.
# Also assemble a list of tool targets to expose in the config file for informational purposes.
set ( extra_cmake_statements "" )
set ( tool_targets "" )
2019-12-05 12:54:07 +00:00
set ( tool_targets_non_prefixed "" )
2019-11-15 15:28:17 +00:00
# List of package dependencies that need be find_package'd when using the Tools package.
set ( package_deps "" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
foreach ( tool_name ${ QT_KNOWN_MODULE_${module_name } _TOOLS} )
2019-11-15 15:28:17 +00:00
# Specific tools can have package dependencies.
# e.g. qtwaylandscanner depends on WaylandScanner (non-qt package).
get_target_property ( extra_packages "${tool_name}" QT_EXTRA_PACKAGE_DEPENDENCIES )
if ( extra_packages )
list ( APPEND package_deps "${extra_packages}" )
endif ( )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
set ( extra_cmake_statements " ${ extra_cmake_statements }
2019-06-11 13:46:31 +00:00
if ( NOT QT_NO_CREATE_TARGETS )
get_property ( is_global TARGET ${ INSTALL_CMAKE_NAMESPACE } :: ${ tool_name } PROPERTY IMPORTED_GLOBAL )
if ( NOT is_global )
set_property ( TARGET ${ INSTALL_CMAKE_NAMESPACE } :: ${ tool_name } PROPERTY IMPORTED_GLOBAL TRUE )
endif ( )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
endif ( )
" )
list ( APPEND tool_targets "${QT_CMAKE_EXPORT_NAMESPACE}::${tool_name}" )
2019-12-05 12:54:07 +00:00
list ( APPEND tool_targets_non_prefixed "${tool_name}" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
endforeach ( )
string ( APPEND extra_cmake_statements
" set ( ${ QT_CMAKE_EXPORT_NAMESPACE } ${ module_name } Tools_TARGETS \"${tool_targets}\")")
2019-11-15 15:28:17 +00:00
# Extract package dependencies that were determined in QtPostProcess, but only if ${module_name}
# is an actual target.
# module_name can be a non-existent target, if the tool doesn't have an existing associated
# module, e.g. qtwaylandscanner.
if ( TARGET "${module_name}" )
get_target_property ( module_package_deps "${module_name}" _qt_tools_package_deps )
if ( module_package_deps )
list ( APPEND package_deps "${module_package_deps}" )
endif ( )
endif ( )
# Configure and install dependencies file for the ${module_name}Tools package.
configure_file (
" $ { Q T _ C M A K E _ D I R } / Q t M o d u l e T o o l s D e p e n d e n c i e s . c m a k e . i n "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } D e p e n d e n c i e s . c m a k e "
@ O N L Y
)
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } D e p e n d e n c i e s . c m a k e "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
# Configure and install the ${module_name}Tools package Config file.
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
configure_package_config_file (
" $ { Q T _ C M A K E _ D I R } / Q t M o d u l e T o o l s C o n f i g . c m a k e . i n "
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g . c m a k e "
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
I N S T A L L _ D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
write_basic_package_version_file (
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
)
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g . c m a k e "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets" )
qt_install ( EXPORT "${export_name}"
N A M E S P A C E " $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } " )
2019-12-05 12:54:07 +00:00
# Create versionless targets file.
configure_file (
" $ { Q T _ C M A K E _ D I R } / Q t M o d u l e T o o l s V e r s i o n l e s s T a r g e t s . c m a k e . i n "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } V e r s i o n l e s s T a r g e t s . c m a k e "
@ O N L Y
)
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } V e r s i o n l e s s T a r g e t s . c m a k e "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-11-15 15:28:17 +00:00
# This function records a dependency between ${target_name} and ${dep_package_name}.
# at the CMake package level.
# E.g. The Tools package that provides the qtwaylandscanner target
# needs to call find_package(WaylandScanner) (non-qt-package).
# main_target_name = qtwaylandscanner
# dep_package_name = WaylandScanner
function ( qt_record_extra_package_dependency main_target_name dep_package_name dep_package_version )
get_target_property ( extra_packages "${main_target_name}" QT_EXTRA_PACKAGE_DEPENDENCIES )
if ( NOT extra_packages )
set ( extra_packages "" )
endif ( )
list ( APPEND extra_packages "${dep_package_name}\;${dep_package_version}" )
set_target_properties ( "${main_target_name}" PROPERTIES QT_EXTRA_PACKAGE_DEPENDENCIES
" $ { e x t r a _ p a c k a g e s } " )
endfunction ( )
# This function records a dependency between ${main_target_name} and ${dep_target_name}
# at the CMake package level.
# E.g. Qt6CoreConfig.cmake needs to find_package(Qt6WinMain).
# main_target_name = Core
# dep_target_name = WinMain
# This is just a convenience function that deals with Qt targets and their associated packages
# instead of raw package names.
function ( qt_record_extra_qt_package_dependency main_target_name dep_target_name
d e p _ p a c k a g e _ v e r s i o n )
# WinMain -> Qt6WinMain.
qt_internal_module_info ( qtfied_target_name "${dep_target_name}" )
qt_record_extra_package_dependency ( "${main_target_name}" "${qtfied_target_name_versioned}"
" $ { d e p _ p a c k a g e _ v e r s i o n } " )
endfunction ( )
2019-03-26 12:32:34 +00:00
function ( qt_internal_check_directory_or_type name dir type default result_var )
if ( "x${dir}" STREQUAL x )
if ( "x${type}" STREQUAL x )
2019-11-13 13:03:20 +00:00
message ( FATAL_ERROR "qt_add_plugin called without setting either TYPE or ${name}." )
2019-03-26 12:32:34 +00:00
endif ( )
set ( ${ result_var } "${default}" PARENT_SCOPE )
else ( )
set ( ${ result_var } "${dir}" PARENT_SCOPE )
endif ( )
endfunction ( )
2019-05-03 14:03:15 +00:00
# Utility function to find the module to which a plug-in belongs.
# This will set the QT_MODULE target property on the plug-in - e.g. "Gui", "Sql"...
function ( qt_get_module_for_plugin target target_type )
2019-08-20 13:24:14 +00:00
qt_internal_get_qt_all_known_modules ( known_modules )
2019-11-15 14:43:20 +00:00
qt_get_sanitized_plugin_type ( "${target_type}" target_type )
2019-08-15 17:12:31 +00:00
foreach ( qt_module ${ known_modules } )
2019-08-28 09:54:25 +00:00
get_target_property ( module_type "${QT_CMAKE_EXPORT_NAMESPACE}::${qt_module}" TYPE )
# Assuming interface libraries can't have plugins. Otherwise we'll need to fix the property
# name, because the current one would be invalid for interface libraries.
if ( module_type STREQUAL "INTERFACE_LIBRARY" )
continue ( )
endif ( )
2019-08-15 17:12:31 +00:00
get_target_property ( plugin_types
" $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : $ { q t _ m o d u l e } "
M O D U L E _ P L U G I N _ T Y P E S )
2019-05-03 14:03:15 +00:00
if ( plugin_types )
foreach ( plugin_type ${ plugin_types } )
if ( "${target_type}" STREQUAL "${plugin_type}" )
set_target_properties ( "${target}" PROPERTIES QT_MODULE "${qt_module}" )
return ( )
endif ( )
endforeach ( )
endif ( )
endforeach ( )
message ( AUTHOR_WARNING "The plug-in '${target}' does not belong to any Qt module." )
endfunction ( )
2019-07-18 07:38:37 +00:00
2019-11-13 13:03:20 +00:00
# Collection of qt_add_plugin arguments so they can be shared across different
2019-07-18 07:38:37 +00:00
# plugin type wrappers
2019-11-13 13:03:20 +00:00
set ( __qt_add_plugin_optional_args
2019-10-21 09:31:28 +00:00
" S T A T I C ; E X C E P T I O N S ; A L L O W _ U N D E F I N E D _ S Y M B O L S "
2019-07-18 07:38:37 +00:00
)
2019-11-13 13:03:20 +00:00
set ( __qt_add_plugin_single_args
2020-01-22 13:22:19 +00:00
" T Y P E ; C L A S S _ N A M E ; O U T P U T _ D I R E C T O R Y ; I N S T A L L _ D I R E C T O R Y ; A R C H I V E _ I N S T A L L _ D I R E C T O R Y ; Q M L _ T A R G E T _ P A T H ; O U T P U T _ N A M E "
2019-07-18 07:38:37 +00:00
)
2019-11-13 13:03:20 +00:00
set ( __qt_add_plugin_multi_args
2019-07-18 07:38:37 +00:00
" $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } ; D E F A U L T _ I F "
)
2018-10-24 13:20:27 +00:00
# This is the main entry point for defining Qt plugins.
2018-12-11 10:38:20 +00:00
# A CMake target is created with the given target. The TYPE parameter is needed to place the
2018-10-24 13:20:27 +00:00
# plugin into the correct plugins/ sub-directory.
2019-11-13 13:03:20 +00:00
function ( qt_add_plugin target )
2018-12-11 10:38:20 +00:00
qt_internal_module_info ( module "${target}" )
2018-10-24 13:20:27 +00:00
2019-05-03 14:03:15 +00:00
qt_internal_set_qt_known_plugins ( "${QT_KNOWN_PLUGINS}" "${target}" )
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_plugin"
" $ { _ _ q t _ a d d _ p l u g i n _ o p t i o n a l _ a r g s } ; S K I P _ I N S T A L L "
" $ { _ _ q t _ a d d _ p l u g i n _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ p l u g i n _ m u l t i _ a r g s } "
2019-07-18 07:38:37 +00:00
" $ { A R G N } "
)
2019-03-26 12:32:34 +00:00
2019-04-08 15:23:57 +00:00
qt_get_sanitized_plugin_type ( "${arg_TYPE}" arg_TYPE )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( output_directory_default "${QT_BUILD_DIR}/${INSTALL_PLUGINSDIR}/${arg_TYPE}" )
2019-06-05 11:39:41 +00:00
set ( install_directory_default "${INSTALL_PLUGINSDIR}/${arg_TYPE}" )
set ( archive_install_directory_default "${INSTALL_LIBDIR}/${arg_TYPE}" )
if ( arg_QML_TARGET_PATH )
set ( target_path "${arg_QML_TARGET_PATH}" )
set ( output_directory_default "${QT_BUILD_DIR}/${INSTALL_QMLDIR}/${target_path}" )
set ( install_directory_default "${INSTALL_QMLDIR}/${target_path}" )
set ( archive_install_directory_default "${INSTALL_QMLDIR}/${target_path}" )
endif ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
2020-01-22 13:22:19 +00:00
# Derive the class name from the target name if it's not explicitly specified.
# Don't set it for qml plugins though.
set ( plugin_class_name "" )
if ( NOT arg_CLASS_NAME AND NOT "${arg_TYPE}" STREQUAL "qml_plugin" )
set ( plugin_class_name "${target}" )
2019-05-03 14:03:15 +00:00
endif ( )
2019-03-26 12:32:34 +00:00
qt_internal_check_directory_or_type ( OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" "${arg_TYPE}"
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { o u t p u t _ d i r e c t o r y _ d e f a u l t } " o u t p u t _ d i r e c t o r y )
2019-10-10 15:02:59 +00:00
if ( NOT arg_SKIP_INSTALL )
qt_internal_check_directory_or_type ( INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}"
" $ { i n s t a l l _ d i r e c t o r y _ d e f a u l t } " i n s t a l l _ d i r e c t o r y )
if ( NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY )
set ( arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" )
endif ( )
2019-10-10 12:21:02 +00:00
endif ( )
2018-10-24 13:20:27 +00:00
2019-06-07 07:13:31 +00:00
if ( arg_STATIC OR NOT BUILD_SHARED_LIBS )
2019-03-26 12:32:34 +00:00
add_library ( "${target}" STATIC )
else ( )
2019-06-04 12:38:24 +00:00
add_library ( "${target}" MODULE )
2019-06-24 13:07:07 +00:00
if ( APPLE )
# CMake defaults to using .so extensions for loadable modules, aka plugins,
# but Qt plugins are actually suffixed with .dylib.
set_property ( TARGET "${target}" PROPERTY SUFFIX ".dylib" )
endif ( )
2019-03-26 12:32:34 +00:00
endif ( )
2019-08-30 09:34:23 +00:00
2020-01-22 13:22:19 +00:00
# Make sure the Qt6 plugin library names are like they were in Qt5 qmake land.
# Whereas the Qt6 CMake target names are like the Qt5 CMake target names.
set ( output_name "${target}" )
if ( arg_OUTPUT_NAME )
set ( output_name "${arg_OUTPUT_NAME}" )
endif ( )
set_property ( TARGET "${target}" PROPERTY OUTPUT_NAME "${output_name}" )
# Add a custom target with the Qt5 qmake name for a more user friendly ninja experience.
2020-01-27 14:03:08 +00:00
if ( arg_OUTPUT_NAME AND NOT TARGET "${output_name}" )
2020-01-22 13:22:19 +00:00
add_custom_target ( "${output_name}" )
add_dependencies ( "${output_name}" "${target}" )
endif ( )
2019-08-30 09:34:23 +00:00
if ( ANDROID )
qt_android_apply_arch_suffix ( "${target}" )
2019-10-22 14:19:13 +00:00
set_target_properties ( ${ target }
P R O P E R T I E S
2020-01-22 13:22:19 +00:00
L I B R A R Y _ O U T P U T _ N A M E " p l u g i n s _ $ { a r g _ T Y P E } _ $ { o u t p u t _ n a m e } "
2019-10-22 14:19:13 +00:00
)
2019-08-30 09:34:23 +00:00
endif ( )
2018-12-11 10:38:20 +00:00
qt_internal_add_target_aliases ( "${target}" )
2019-10-15 09:10:08 +00:00
qt_skip_warnings_are_errors_when_repo_unclean ( "${target}" )
2018-10-24 13:20:27 +00:00
2019-11-21 12:33:28 +00:00
# Disable linking of plugins against other plugins during static regular and
# super builds. The latter causes cyclic dependencies otherwise.
set_target_properties ( ${ target } PROPERTIES QT_DEFAULT_PLUGINS 0 )
2018-12-11 10:38:20 +00:00
set_target_properties ( "${target}" PROPERTIES
2019-03-26 12:32:34 +00:00
L I B R A R Y _ O U T P U T _ D I R E C T O R Y " $ { o u t p u t _ d i r e c t o r y } "
R U N T I M E _ O U T P U T _ D I R E C T O R Y " $ { o u t p u t _ d i r e c t o r y } "
2019-05-03 14:03:15 +00:00
A R C H I V E _ O U T P U T _ D I R E C T O R Y " $ { o u t p u t _ d i r e c t o r y } "
2020-01-22 13:22:19 +00:00
Q T _ P L U G I N _ C L A S S _ N A M E " $ { p l u g i n _ c l a s s _ n a m e } " )
2019-12-06 14:12:17 +00:00
qt_handle_multi_config_output_dirs ( "${target}" )
2018-10-24 13:20:27 +00:00
qt_internal_library_deprecation_level ( deprecation_define )
2019-05-22 13:09:39 +00:00
qt_autogen_tools_initial_setup ( ${ target } )
2019-03-06 12:51:38 +00:00
2019-03-26 12:39:43 +00:00
set ( static_plugin_define "" )
if ( arg_STATIC OR NOT QT_BUILD_SHARED_LIBS )
set ( static_plugin_define "QT_STATICPLUGIN" )
endif ( )
2019-05-03 14:03:15 +00:00
# Save the Qt module in the plug-in's properties
2019-07-22 15:44:55 +00:00
if ( NOT arg_TYPE STREQUAL "qml_plugin" )
qt_get_module_for_plugin ( "${target}" "${arg_TYPE}" )
get_target_property ( qt_module "${target}" QT_MODULE )
endif ( )
2019-05-03 14:03:15 +00:00
# Add the plug-in to the list of plug-ins of this module
if ( TARGET "${qt_module}" )
set_property ( TARGET "${qt_module}" APPEND PROPERTY QT_PLUGINS "${target}" )
endif ( )
2019-07-05 09:55:05 +00:00
set ( _default_plugin 1 )
if ( DEFINED arg_DEFAULT_IF )
if ( NOT ${ arg_DEFAULT_IF } )
set ( _default_plugin 0 )
endif ( )
endif ( )
set_property ( TARGET "${target}" PROPERTY QT_DEFAULT_PLUGIN "${_default_plugin}" )
2019-09-23 14:57:06 +00:00
set_property ( TARGET "${target}" APPEND PROPERTY EXPORT_PROPERTIES "QT_PLUGIN_CLASS_NAME;QT_PLUGIN_TYPE;QT_MODULE;QT_DEFAULT_PLUGIN" )
2019-06-05 08:08:44 +00:00
2019-08-08 14:55:48 +00:00
set ( private_includes
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
# For the syncqt headers
" $ < B U I L D _ I N T E R F A C E : $ { m o d u l e _ r e p o _ i n c l u d e _ d i r } > "
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
)
set ( public_includes
$ { a r g _ P U B L I C _ I N C L U D E _ D I R E C T O R I E S }
)
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${target}"
2018-12-07 12:13:24 +00:00
S O U R C E S $ { a r g _ S O U R C E S }
2018-10-24 13:20:27 +00:00
I N C L U D E _ D I R E C T O R I E S
2019-08-08 14:55:48 +00:00
$ { p r i v a t e _ i n c l u d e s }
P U B L I C _ I N C L U D E _ D I R E C T O R I E S
$ { p u b l i c _ i n c l u d e s }
2019-06-05 14:05:50 +00:00
L I B R A R I E S $ { a r g _ L I B R A R I E S } Q t : : P l a t f o r m P l u g i n I n t e r n a l
2018-12-07 12:13:24 +00:00
P U B L I C _ L I B R A R I E S $ { a r g _ P U B L I C _ L I B R A R I E S }
2018-10-24 13:20:27 +00:00
D E F I N E S
2018-12-07 12:13:24 +00:00
$ { a r g _ D E F I N E S }
2018-10-24 13:20:27 +00:00
Q T _ D E P R E C A T E D _ W A R N I N G S
" $ { d e p r e c a t i o n _ d e f i n e } "
2019-03-26 12:39:43 +00:00
" $ { s t a t i c _ p l u g i n _ d e f i n e } "
2019-03-11 11:34:52 +00:00
Q T _ P L U G I N
2018-10-24 13:20:27 +00:00
P U B L I C _ D E F I N E S
2019-06-05 09:31:55 +00:00
Q T _ $ { m o d u l e _ d e f i n e } _ L I B
2018-12-07 12:13:24 +00:00
$ { a r g _ P U B L I C _ D E F I N E S }
2018-12-11 10:38:20 +00:00
F E A T U R E _ D E P E N D E N C I E S $ { a r g _ F E A T U R E _ D E P E N D E N C I E S }
2018-12-07 12:13:24 +00:00
D B U S _ A D A P T O R _ S O U R C E S " $ { a r g _ D B U S _ A D A P T O R _ S O U R C E S } "
D B U S _ A D A P T O R _ F L A G S " $ { a r g _ D B U S _ A D A P T O R _ F L A G S } "
D B U S _ I N T E R F A C E _ S O U R C E S " $ { a r g _ D B U S _ I N T E R F A C E _ S O U R C E S } "
D B U S _ I N T E R F A C E _ F L A G S " $ { a r g _ D B U S _ I N T E R F A C E _ F L A G S } "
2019-01-29 11:07:24 +00:00
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
P U B L I C _ C O M P I L E _ O P T I O N S $ { a r g _ P U B L I C _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
P U B L I C _ L I N K _ O P T I O N S $ { a r g _ P U B L I C _ L I N K _ O P T I O N S }
2019-01-30 15:43:11 +00:00
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
2019-05-22 13:09:39 +00:00
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
2018-10-24 13:20:27 +00:00
)
2019-06-04 13:55:41 +00:00
if ( NOT ${ arg_EXCEPTIONS } )
qt_internal_set_no_exceptions_flags ( "${target}" )
endif ( )
2019-06-04 15:09:14 +00:00
2018-10-24 13:20:27 +00:00
2019-05-03 14:03:15 +00:00
set ( qt_libs_private "" )
2019-08-20 13:24:14 +00:00
qt_internal_get_qt_all_known_modules ( known_modules )
foreach ( it ${ known_modules } )
2019-05-03 14:03:15 +00:00
list ( FIND arg_LIBRARIES "Qt::${it}Private" pos )
if ( pos GREATER -1 )
list ( APPEND qt_libs_private "Qt::${it}Private" )
endif ( )
endforeach ( )
qt_register_target_dependencies ( "${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}" )
2019-10-10 15:02:59 +00:00
if ( NOT arg_SKIP_INSTALL )
# Handle creation of cmake files for consumers of find_package().
# If we are part of a Qt module, the plugin cmake files are installed as part of that module.
if ( qt_module )
set ( path_suffix "${INSTALL_CMAKE_NAMESPACE}${qt_module}" )
else ( )
set ( path_suffix "${INSTALL_CMAKE_NAMESPACE}${target}" )
endif ( )
2019-05-03 14:03:15 +00:00
2019-10-10 15:02:59 +00:00
qt_path_join ( config_build_dir ${ QT_CONFIG_BUILD_DIR } ${ path_suffix } )
qt_path_join ( config_install_dir ${ QT_CONFIG_INSTALL_DIR } ${ path_suffix } )
2019-05-03 14:03:15 +00:00
2019-10-10 15:02:59 +00:00
configure_package_config_file (
" $ { Q T _ C M A K E _ D I R } / Q t P l u g i n C o n f i g . c m a k e . i n "
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g . c m a k e "
I N S T A L L _ D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
write_basic_package_version_file (
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
)
2019-05-03 14:03:15 +00:00
2019-10-10 15:02:59 +00:00
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g . c m a k e "
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
2019-05-03 14:03:15 +00:00
2019-10-10 15:02:59 +00:00
# Make the export name of plugins be consistent with modules, so that
2019-11-13 13:03:20 +00:00
# qt_add_resource adds its additional targets to the same export set in a static Qt build.
2019-10-10 15:02:59 +00:00
set ( export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets" )
qt_install ( TARGETS "${target}"
E X P O R T $ { e x p o r t _ n a m e }
R U N T I M E D E S T I N A T I O N " $ { i n s t a l l _ d i r e c t o r y } "
L I B R A R Y D E S T I N A T I O N " $ { i n s t a l l _ d i r e c t o r y } "
A R C H I V E D E S T I N A T I O N " $ { a r c h i v e _ i n s t a l l _ d i r e c t o r y } "
)
qt_install ( EXPORT ${ export_name }
N A M E S P A C E $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : :
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
endif ( )
2018-10-24 13:20:27 +00:00
2019-09-23 14:57:06 +00:00
# Store the plug-in type in the target property
set_property ( TARGET "${target}" PROPERTY QT_PLUGIN_TYPE "${arg_TYPE}" )
2019-10-21 09:31:28 +00:00
if ( NOT arg_ALLOW_UNDEFINED_SYMBOLS )
### fixme: cmake is missing a built-in variable for this. We want to apply it only to
# modules and plugins that belong to Qt.
qt_internal_add_link_flags_no_undefined ( "${target}" )
endif ( )
2018-10-24 13:20:27 +00:00
2018-12-11 10:38:20 +00:00
qt_internal_add_linker_version_script ( ${ target } )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-08-01 13:43:36 +00:00
function ( qt_install_qml_files target )
qt_parse_all_arguments ( arg "qt_install_qml_files"
" " " " " F I L E S " $ { A R G N }
)
if ( NOT arg_FILES )
message ( FATAL_ERROR "No files specified for qt_install_qml_files. Please specify them using the FILES parameter." )
endif ( )
get_target_property ( target_path ${ target } QT_QML_MODULE_TARGET_PATH )
if ( NOT target_path )
message ( FATAL_ERROR "Target ${target} is not a qml module." )
endif ( )
qt_path_join ( qml_module_install_dir ${ QT_INSTALL_DIR } "${INSTALL_QMLDIR}/${target_path}" )
qt_copy_or_install ( FILES ${ arg_FILES }
D E S T I N A T I O N $ { q m l _ m o d u l e _ i n s t a l l _ d i r }
)
endfunction ( )
2019-08-19 14:19:08 +00:00
2019-11-13 13:03:20 +00:00
function ( qt_add_resource target resourceName )
2019-08-19 14:19:08 +00:00
# Don't try to add resources when cross compiling, and the target is actually a host target
# (like a tool).
qt_is_imported_target ( "${target}" is_imported )
if ( is_imported )
return ( )
endif ( )
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_resource" "" "PREFIX;LANG;BASE" "FILES" ${ ARGN } )
2019-08-19 14:19:08 +00:00
QT6_PROCESS_RESOURCE ( ${ target } ${ resourceName }
P R E F I X " $ { a r g _ P R E F I X } "
L A N G " $ { a r g _ L A N G } "
B A S E " $ { a r g _ B A S E } "
F I L E S $ { a r g _ F I L E S }
2019-09-16 07:49:40 +00:00
O U T P U T _ T A R G E T S o u t _ t a r g e t s
2019-08-19 14:19:08 +00:00
)
2019-09-16 07:49:40 +00:00
if ( out_targets )
2019-09-18 14:18:32 +00:00
qt_install ( TARGETS ${ out_targets }
E X P O R T " $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } T a r g e t s "
D E S T I N A T I O N $ { I N S T A L L _ L I B D I R }
)
2019-08-19 14:19:08 +00:00
endif ( )
endfunction ( )
2019-11-13 13:03:20 +00:00
# Collection of qt_add_executable arguments so they can be shared across qt_add_executable
# and qt_add_test_helper.
set ( __qt_add_executable_optional_args
2019-08-12 13:51:17 +00:00
" G U I ; B O O T S T R A P ; N O _ Q T ; N O _ I N S T A L L ; E X C E P T I O N S "
)
2019-11-13 13:03:20 +00:00
set ( __qt_add_executable_single_args
2019-08-12 13:51:17 +00:00
" O U T P U T _ D I R E C T O R Y ; I N S T A L L _ D I R E C T O R Y "
)
2019-11-13 13:03:20 +00:00
set ( __qt_add_executable_multi_args
2019-08-12 13:51:17 +00:00
" E X E _ F L A G S ; $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } "
)
2018-10-24 13:20:27 +00:00
# This function creates a CMake target for a generic console or GUI binary.
# Please consider to use a more specific version target like the one created
2019-11-13 13:03:20 +00:00
# by qt_add_test or qt_add_tool below.
function ( qt_add_executable name )
qt_parse_all_arguments ( arg "qt_add_executable"
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-08-12 13:51:17 +00:00
$ { A R G N } )
2018-10-24 13:20:27 +00:00
2018-12-07 12:13:24 +00:00
if ( "x${arg_OUTPUT_DIRECTORY}" STREQUAL "x" )
2019-11-21 12:33:28 +00:00
set ( arg_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}" )
2018-10-24 13:20:27 +00:00
endif ( )
2019-03-18 17:49:04 +00:00
get_filename_component ( arg_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}"
2019-11-21 12:33:28 +00:00
A B S O L U T E B A S E _ D I R " $ { Q T _ B U I L D _ D I R } " )
2019-03-18 17:49:04 +00:00
2019-03-18 18:09:27 +00:00
if ( "x${arg_INSTALL_DIRECTORY}" STREQUAL "x" )
set ( arg_INSTALL_DIRECTORY "${INSTALL_BINDIR}" )
endif ( )
2019-10-24 08:50:06 +00:00
if ( ANDROID )
add_library ( "${name}" MODULE )
qt_android_apply_arch_suffix ( "${name}" )
qt_android_generate_deployment_settings ( "${name}" )
qt_android_add_apk_target ( "${name}" )
# On our qmake builds we don't compile the executables with
# visibility=hidden. Not having this flag set will cause the
# executable to have main() hidden and can then no longer be loaded
# through dlopen()
set_property ( TARGET ${ name } PROPERTY C_VISIBILITY_PRESET default )
set_property ( TARGET ${ name } PROPERTY CXX_VISIBILITY_PRESET default )
else ( )
add_executable ( "${name}" ${ arg_EXE_FLAGS } )
endif ( )
2019-03-06 12:51:38 +00:00
2019-05-22 13:09:39 +00:00
qt_autogen_tools_initial_setup ( ${ name } )
2019-11-13 09:09:17 +00:00
qt_skip_warnings_are_errors_when_repo_unclean ( "${name}" )
2019-03-06 12:51:38 +00:00
2019-03-20 11:09:12 +00:00
set ( extra_libraries "" )
2019-04-29 14:32:21 +00:00
if ( NOT arg_BOOTSTRAP AND NOT arg_NO_QT )
2019-03-20 11:09:12 +00:00
set ( extra_libraries "Qt::Core" )
endif ( )
2019-08-08 14:55:48 +00:00
set ( private_includes
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
)
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${name}"
2018-12-07 12:13:24 +00:00
S O U R C E S $ { a r g _ S O U R C E S }
2019-08-08 14:55:48 +00:00
I N C L U D E _ D I R E C T O R I E S $ { p r i v a t e _ i n c l u d e s }
2018-12-07 12:13:24 +00:00
D E F I N E S $ { a r g _ D E F I N E S }
2019-05-09 08:02:37 +00:00
L I B R A R I E S $ { a r g _ L I B R A R I E S }
2019-08-02 12:14:16 +00:00
P U B L I C _ L I B R A R I E S $ { e x t r a _ l i b r a r i e s } $ { a r g _ P U B L I C _ L I B R A R I E S }
2018-12-07 12:13:24 +00:00
D B U S _ A D A P T O R _ S O U R C E S " $ { a r g _ D B U S _ A D A P T O R _ S O U R C E S } "
D B U S _ A D A P T O R _ F L A G S " $ { a r g _ D B U S _ A D A P T O R _ F L A G S } "
D B U S _ I N T E R F A C E _ S O U R C E S " $ { a r g _ D B U S _ I N T E R F A C E _ S O U R C E S } "
D B U S _ I N T E R F A C E _ F L A G S " $ { a r g _ D B U S _ I N T E R F A C E _ F L A G S } "
2019-01-29 11:07:24 +00:00
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
2019-01-30 15:43:11 +00:00
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
2019-05-22 13:09:39 +00:00
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
2018-10-24 13:20:27 +00:00
)
set_target_properties ( "${name}" PROPERTIES
2018-12-07 12:13:24 +00:00
R U N T I M E _ O U T P U T _ D I R E C T O R Y " $ { a r g _ O U T P U T _ D I R E C T O R Y } "
2019-10-24 08:50:06 +00:00
L I B R A R Y _ O U T P U T _ D I R E C T O R Y " $ { a r g _ O U T P U T _ D I R E C T O R Y } "
2018-12-07 12:13:24 +00:00
W I N 3 2 _ E X E C U T A B L E " $ { a r g _ G U I } "
M A C O S X _ B U N D L E " $ { a r g _ G U I } "
2018-10-24 13:20:27 +00:00
)
2019-06-04 13:55:41 +00:00
if ( NOT ${ arg_EXCEPTIONS } )
qt_internal_set_no_exceptions_flags ( "${name}" )
endif ( )
2019-06-04 15:09:14 +00:00
2019-03-18 18:09:27 +00:00
2019-04-03 09:33:28 +00:00
if ( NOT arg_NO_INSTALL )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( TARGETS "${name}"
2019-04-03 09:33:28 +00:00
R U N T I M E D E S T I N A T I O N " $ { a r g _ I N S T A L L _ D I R E C T O R Y } "
2019-10-24 08:50:06 +00:00
L I B R A R Y D E S T I N A T I O N " $ { a r g _ I N S T A L L _ D I R E C T O R Y } "
2019-04-03 09:33:28 +00:00
B U N D L E D E S T I N A T I O N " $ { a r g _ I N S T A L L _ D I R E C T O R Y } " )
endif ( )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-11-13 13:03:20 +00:00
# Simple wrapper around qt_add_executable for benchmarks which insure that
2019-10-28 14:35:47 +00:00
# the binary is built under ${CMAKE_CURRENT_BINARY_DIR} and never installed.
2019-11-13 13:03:20 +00:00
# See qt_add_executable() for more details.
function ( qt_add_benchmark target )
2019-10-28 14:35:47 +00:00
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_benchmark"
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-10-28 14:35:47 +00:00
$ { A R G N }
)
qt_remove_args ( exec_args
A R G S _ T O _ R E M O V E
$ { t a r g e t }
O U T P U T _ D I R E C T O R Y
I N S T A L L _ D I R E C T O R Y
A L L _ A R G S
2019-11-13 13:03:20 +00:00
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-10-28 14:35:47 +00:00
A R G S
$ { A R G V }
)
2019-11-13 13:03:20 +00:00
qt_add_executable ( ${ target }
2019-10-28 14:35:47 +00:00
N O _ I N S T A L L # we don't install benchmarks
O U T P U T _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " # avoid polluting bin directory
$ { e x e c _ a r g s }
)
endfunction ( )
2018-10-24 13:20:27 +00:00
2019-11-13 13:03:20 +00:00
# Simple wrapper around qt_add_executable for manual tests which insure that
2019-11-12 14:31:34 +00:00
# the binary is built under ${CMAKE_CURRENT_BINARY_DIR} and never installed.
2019-11-13 13:03:20 +00:00
# See qt_add_executable() for more details.
function ( qt_add_manual_test target )
2019-11-12 14:31:34 +00:00
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_manual_test"
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-11-12 14:31:34 +00:00
$ { A R G N }
)
qt_remove_args ( exec_args
A R G S _ T O _ R E M O V E
$ { t a r g e t }
O U T P U T _ D I R E C T O R Y
I N S T A L L _ D I R E C T O R Y
A L L _ A R G S
2019-11-13 13:03:20 +00:00
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-11-12 14:31:34 +00:00
A R G S
$ { A R G V }
)
2019-11-13 13:03:20 +00:00
qt_add_executable ( ${ target }
2019-11-12 14:31:34 +00:00
N O _ I N S T A L L # we don't install benchmarks
O U T P U T _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " # avoid polluting bin directory
$ { e x e c _ a r g s }
)
endfunction ( )
2018-10-24 13:20:27 +00:00
# This function creates a CMake test target with the specified name for use with CTest.
2019-11-13 13:03:20 +00:00
function ( qt_add_test name )
qt_parse_all_arguments ( arg "qt_add_test"
2019-07-22 10:55:48 +00:00
" R U N _ S E R I A L ; E X C E P T I O N S ; G U I ; Q M L T E S T "
2020-01-13 09:19:13 +00:00
" O U T P U T _ D I R E C T O R Y ; W O R K I N G _ D I R E C T O R Y ; T I M E O U T "
2019-12-10 13:21:36 +00:00
" Q M L _ I M P O R T P A T H ; T E S T D A T A ; $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } " $ { A R G N }
)
2019-08-26 09:08:52 +00:00
if ( NOT arg_OUTPUT_DIRECTORY )
set ( arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )
endif ( )
2018-10-24 13:20:27 +00:00
2019-06-04 13:55:41 +00:00
if ( ${ arg_EXCEPTIONS } )
2019-07-22 10:55:48 +00:00
set ( exceptions_text "EXCEPTIONS" )
endif ( )
if ( ${ arg_GUI } )
set ( gui_text "GUI" )
2019-06-04 13:55:41 +00:00
endif ( )
2019-08-08 14:46:05 +00:00
# Handle cases where we have a qml test without source files
if ( arg_SOURCES )
set ( private_includes
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
2020-01-26 11:25:40 +00:00
" $ < B U I L D _ I N T E R F A C E : $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ I N C L U D E D I R } > "
2019-08-08 14:46:05 +00:00
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
)
2019-08-08 14:55:48 +00:00
2019-11-13 13:03:20 +00:00
qt_add_executable ( "${name}"
2019-08-08 14:46:05 +00:00
$ { e x c e p t i o n s _ t e x t }
$ { g u i _ t e x t }
N O _ I N S T A L L
2019-08-26 09:08:52 +00:00
O U T P U T _ D I R E C T O R Y " $ { a r g _ O U T P U T _ D I R E C T O R Y } "
2019-08-08 14:46:05 +00:00
S O U R C E S " $ { a r g _ S O U R C E S } "
I N C L U D E _ D I R E C T O R I E S
$ { p r i v a t e _ i n c l u d e s }
D E F I N E S
Q T _ T E S T C A S E _ B U I L D D I R = " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
Q T _ T E S T C A S E _ S O U R C E D I R = " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
$ { a r g _ D E F I N E S }
P U B L I C _ L I B R A R I E S $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : C o r e $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : T e s t $ { a r g _ P U B L I C _ L I B R A R I E S }
L I B R A R I E S $ { a r g _ L I B R A R I E S }
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
)
2018-10-24 13:20:27 +00:00
2019-08-12 13:51:17 +00:00
# Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
# assumptions about the location of helper processes, and those paths would be different
# if a test is built as a bundle.
set_property ( TARGET "${name}" PROPERTY MACOSX_BUNDLE FALSE )
2019-09-16 10:41:43 +00:00
# The same goes for WIN32_EXECUTABLE, but because it will detach from the console window
# and not print anything.
set_property ( TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE )
2019-08-12 13:51:17 +00:00
2019-08-08 14:46:05 +00:00
# QMLTest specifics
2019-07-22 10:55:48 +00:00
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${name}" CONDITION arg_QMLTEST
2019-08-08 14:46:05 +00:00
P U B L I C _ L I B R A R I E S $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : Q u i c k T e s t
)
2019-07-22 10:55:48 +00:00
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${name}" CONDITION arg_QMLTEST AND NOT ANDROID
2019-08-08 14:46:05 +00:00
D E F I N E S
Q U I C K _ T E S T _ S O U R C E _ D I R = " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
)
2019-07-22 10:55:48 +00:00
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${name}" CONDITION arg_QMLTEST AND ANDROID
2019-08-08 14:46:05 +00:00
D E F I N E S
Q U I C K _ T E S T _ S O U R C E _ D I R = " : / "
)
endif ( )
2019-07-22 10:55:48 +00:00
2019-09-17 09:27:47 +00:00
foreach ( path IN LISTS arg_QML_IMPORTPATH )
list ( APPEND extra_test_args "-import" "${path}" )
endforeach ( )
2019-07-22 10:55:48 +00:00
2019-06-25 08:57:20 +00:00
# Generate a label in the form tests/auto/foo/bar/tst_baz
# and use it also for XML output
file ( RELATIVE_PATH label "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${name}" )
2018-10-24 13:20:27 +00:00
2019-10-24 08:50:06 +00:00
if ( ANDROID )
qt_android_add_test ( "${name}" )
2019-07-22 10:55:48 +00:00
else ( )
2019-10-24 08:50:06 +00:00
if ( arg_QMLTEST AND NOT arg_SOURCES )
set ( test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}" )
set ( test_executable ${ QT_CMAKE_EXPORT_NAMESPACE } ::qmltestrunner )
else ( )
2019-12-10 13:21:36 +00:00
if ( arg_WORKING_DIRECTORY )
set ( test_working_dir "${arg_WORKING_DIRECTORY}" )
2020-02-12 16:19:17 +00:00
elseif ( arg_OUTPUT_DIRECTORY )
set ( test_working_dir "${arg_OUTPUT_DIRECTORY}" )
2019-12-10 13:21:36 +00:00
else ( )
set ( test_working_dir "${CMAKE_CURRENT_BINARY_DIR}" )
endif ( )
2019-10-24 08:50:06 +00:00
set ( test_executable "${name}" )
endif ( )
2019-06-25 08:57:20 +00:00
2019-10-24 08:50:06 +00:00
add_test ( NAME "${name}" COMMAND ${ test_executable } ${ extra_test_args } -o ${ name } .xml,xml -o -,txt WORKING_DIRECTORY "${test_working_dir}" )
endif ( )
2019-06-25 08:57:20 +00:00
set_tests_properties ( "${name}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}" LABELS "${label}" )
2020-01-13 09:19:13 +00:00
if ( arg_TIMEOUT )
set_tests_properties ( ${ name } PROPERTIES TIMEOUT ${ arg_TIMEOUT } )
endif ( )
2019-09-16 10:41:43 +00:00
# Get path to qtbase/bin, then prepend this path containing the shared libraries to PATH
2020-01-21 14:02:58 +00:00
set ( INSTALL_PREFIX_BIN "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
2020-02-19 12:24:22 +00:00
set ( test_env_path "PATH=${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}${INSTALL_PREFIX_BIN}${QT_PATH_SEPARATOR}$ENV{PATH}" )
string ( REPLACE ";" "\;" test_env_path "${test_env_path}" )
set_property ( TEST "${name}" APPEND PROPERTY ENVIRONMENT "${test_env_path}" )
2020-01-13 12:56:04 +00:00
set_property ( TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST=1" )
2019-07-12 14:54:26 +00:00
2019-07-22 10:55:48 +00:00
# Add the install prefix to list of plugin paths when doing a prefix build
if ( NOT QT_INSTALL_DIR )
list ( APPEND plugin_paths "${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINSDIR}" )
endif ( )
#TODO: Collect all paths from known repositories when performing a super
# build.
list ( APPEND plugin_paths "${PROJECT_BINARY_DIR}/${INSTALL_PLUGINSDIR}" )
list ( JOIN plugin_paths "${QT_PATH_SEPARATOR}" plugin_paths_joined )
set_property ( TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_PLUGIN_PATH=${plugin_paths_joined}" )
2019-07-12 14:54:26 +00:00
if ( ANDROID OR IOS OR WINRT )
set ( builtin_testdata TRUE )
endif ( )
if ( builtin_testdata )
2019-08-22 14:20:03 +00:00
# Safe guard against qml only tests, no source files == no target
if ( TARGET "${name}" )
target_compile_definitions ( "${name}" PRIVATE BUILTIN_TESTDATA )
2019-07-12 14:54:26 +00:00
2019-08-22 14:20:03 +00:00
foreach ( testdata IN LISTS arg_TESTDATA )
list ( APPEND builtin_files ${ testdata } )
endforeach ( )
2019-07-12 14:54:26 +00:00
2019-08-22 14:20:03 +00:00
set ( blacklist_path "BLACKLIST" )
if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}" )
list ( APPEND builtin_files ${ blacklist_path } )
endif ( )
2019-07-12 14:54:26 +00:00
2019-08-22 14:20:03 +00:00
list ( REMOVE_DUPLICATES builtin_files )
2019-07-12 14:54:26 +00:00
2019-08-23 13:43:55 +00:00
# Skip Qt quick compiler when embedding test resources
foreach ( file IN LISTS builtin_files )
set_source_files_properties ( ${ file }
P R O P E R T I E S Q T _ S K I P _ Q U I C K C O M P I L E R T R U E
)
endforeach ( )
2019-08-22 14:20:03 +00:00
if ( builtin_files )
2019-11-13 13:03:20 +00:00
qt_add_resource ( ${ name } "${name}_testdata_builtin"
2019-08-22 14:20:03 +00:00
P R E F I X " / "
F I L E S $ { b u i l t i n _ f i l e s }
B A S E $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } )
endif ( )
2019-07-12 14:54:26 +00:00
endif ( )
else ( )
# Install test data
2019-07-26 16:15:41 +00:00
file ( RELATIVE_PATH relative_path_to_test_project
" $ { Q T _ T O P _ L E V E L _ S O U R C E _ D I R } "
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } " )
qt_path_join ( testdata_install_dir ${ QT_INSTALL_DIR }
2019-08-12 14:29:58 +00:00
" $ { r e l a t i v e _ p a t h _ t o _ t e s t _ p r o j e c t } " )
2019-07-12 14:54:26 +00:00
foreach ( testdata IN LISTS arg_TESTDATA )
set ( testdata "${CMAKE_CURRENT_SOURCE_DIR}/${testdata}" )
if ( IS_DIRECTORY "${testdata}" )
2020-02-12 14:37:12 +00:00
qt_install (
2019-07-12 14:54:26 +00:00
D I R E C T O R Y " $ { t e s t d a t a } "
2019-07-23 07:13:47 +00:00
D E S T I N A T I O N " $ { t e s t d a t a _ i n s t a l l _ d i r } " )
2019-07-12 14:54:26 +00:00
else ( )
2020-02-12 14:37:12 +00:00
qt_install (
2019-07-12 14:54:26 +00:00
F I L E S " $ { t e s t d a t a } "
2019-07-23 07:13:47 +00:00
D E S T I N A T I O N " $ { t e s t d a t a _ i n s t a l l _ d i r } " )
2019-07-12 14:54:26 +00:00
endif ( )
endforeach ( )
endif ( )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-08-12 13:51:17 +00:00
# This function creates an executable for use as a helper program with tests. Some
# tests launch separate programs to test certain input/output behavior.
# Specify OVERRIDE_OUTPUT_DIRECTORY if you dont' want to place the helper in the parent directory,
# in which case you should specify OUTPUT_DIRECTORY "/foo/bar" manually.
2019-11-13 13:03:20 +00:00
function ( qt_add_test_helper name )
2019-08-12 13:51:17 +00:00
2019-11-13 13:03:20 +00:00
set ( qt_add_test_helper_optional_args
2019-08-12 13:51:17 +00:00
" O V E R R I D E _ O U T P U T _ D I R E C T O R Y "
)
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_test_helper"
" $ { q t _ a d d _ t e s t _ h e l p e r _ o p t i o n a l _ a r g s } ; $ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s } "
" $ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s } "
2019-08-12 13:51:17 +00:00
$ { A R G N } )
qt_remove_args ( forward_args
A R G S _ T O _ R E M O V E
" $ { n a m e } "
2019-11-13 13:03:20 +00:00
$ { q t _ a d d _ t e s t _ h e l p e r _ o p t i o n a l _ a r g s }
2019-08-12 13:51:17 +00:00
A L L _ A R G S
2019-11-13 13:03:20 +00:00
$ { q t _ a d d _ t e s t _ h e l p e r _ o p t i o n a l _ a r g s }
$ { _ _ q t _ a d d _ e x e c u t a b l e _ o p t i o n a l _ a r g s }
$ { _ _ q t _ a d d _ e x e c u t a b l e _ s i n g l e _ a r g s }
$ { _ _ q t _ a d d _ e x e c u t a b l e _ m u l t i _ a r g s }
2019-08-12 13:51:17 +00:00
A R G S
$ { A R G V }
)
set ( extra_args_to_pass )
if ( NOT arg_OVERRIDE_OUTPUT_DIRECTORY )
set ( extra_args_to_pass OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." )
endif ( )
2019-11-13 13:03:20 +00:00
qt_add_executable ( "${name}" NO_INSTALL ${ extra_args_to_pass } ${ forward_args } )
2018-10-24 13:20:27 +00:00
endfunction ( )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
# Sets QT_WILL_BUILD_TOOLS if tools will be built.
function ( qt_check_if_tools_will_be_built )
2019-08-16 10:57:31 +00:00
if ( NOT CMAKE_CROSSCOMPILING AND NOT QT_FORCE_FIND_TOOLS )
set ( will_build_tools TRUE )
else ( )
set ( will_build_tools FALSE )
endif ( )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
set ( QT_WILL_BUILD_TOOLS ${ will_build_tools } CACHE INTERNAL "Are tools going to be built" FORCE )
endfunction ( )
2018-10-24 13:20:27 +00:00
2019-10-10 13:40:38 +00:00
# Wrapper function to create a regular cmake target and forward all the
# arguments collected by the conversion script. This is only meant for tests!
2019-11-13 13:03:20 +00:00
function ( qt_add_cmake_library target )
2019-10-10 13:40:38 +00:00
# Process arguments:
2019-11-13 13:03:20 +00:00
qt_parse_all_arguments ( arg "qt_add_cmake_library"
2019-10-10 13:40:38 +00:00
" S H A R E D ; M O D U L E ; S T A T I C ; I N T E R F A C E "
" O U T P U T _ D I R E C T O R Y ; A R C H I V E _ I N S T A L L _ D I R E C T O R Y ; I N S T A L L _ D I R E C T O R Y "
2019-10-11 11:55:59 +00:00
" $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } "
2019-10-10 13:40:38 +00:00
$ { A R G N }
)
### Define Targets:
if ( ${ arg_INTERFACE } )
add_library ( "${target}" INTERFACE )
2019-04-08 15:23:57 +00:00
elseif ( ${ arg_STATIC } OR ( ${ arg_MODULE } AND NOT BUILD_SHARED_LIBS ) )
2019-10-10 13:40:38 +00:00
add_library ( "${target}" STATIC )
elseif ( ${ arg_SHARED } )
add_library ( "${target}" SHARED )
2019-10-23 12:45:20 +00:00
elseif ( ${ arg_MODULE } )
add_library ( "${target}" MODULE )
set_property ( TARGET ${ name } PROPERTY C_VISIBILITY_PRESET default )
set_property ( TARGET ${ name } PROPERTY CXX_VISIBILITY_PRESET default )
2019-11-14 10:24:14 +00:00
if ( APPLE )
# CMake defaults to using .so extensions for loadable modules, aka plugins,
# but Qt plugins are actually suffixed with .dylib.
set_property ( TARGET "${target}" PROPERTY SUFFIX ".dylib" )
endif ( )
2019-10-10 13:40:38 +00:00
else ( )
add_library ( "${target}" )
endif ( )
if ( NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY )
set ( arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" )
endif ( )
2019-10-14 13:18:50 +00:00
if ( ANDROID )
2019-10-10 13:40:38 +00:00
qt_android_apply_arch_suffix ( "${target}" )
endif ( )
2019-10-15 09:10:08 +00:00
qt_skip_warnings_are_errors_when_repo_unclean ( "${target}" )
2019-10-10 13:40:38 +00:00
if ( arg_INSTALL_DIRECTORY )
set ( install_arguments
A R C H I V E _ I N S T A L L _ D I R E C T O R Y $ { a r g _ A R C H I V E _ I N S T A L L _ D I R E C T O R Y }
I N S T A L L _ D I R E C T O R Y $ { a r g _ I N S T A L L _ D I R E C T O R Y }
)
endif ( )
2019-10-11 11:55:59 +00:00
if ( arg_OUTPUT_DIRECTORY )
set_target_properties ( ${ target } PROPERTIES
2019-10-15 12:54:25 +00:00
A R C H I V E _ O U T P U T _ D I R E C T O R Y $ { a r g _ O U T P U T _ D I R E C T O R Y }
R U N T I M E _ O U T P U T _ D I R E C T O R Y $ { a r g _ O U T P U T _ D I R E C T O R Y }
L I B R A R Y _ O U T P U T _ D I R E C T O R Y $ { a r g _ O U T P U T _ D I R E C T O R Y }
2019-10-11 11:55:59 +00:00
)
endif ( )
2019-11-13 13:03:20 +00:00
qt_extend_target ( "${target}"
2019-10-10 13:40:38 +00:00
S O U R C E S $ { a r g _ S O U R C E S }
I N C L U D E _ D I R E C T O R I E S
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
P U B L I C _ I N C L U D E _ D I R E C T O R I E S
$ { a r g _ P U B L I C _ I N C L U D E _ D I R E C T O R I E S }
P U B L I C _ D E F I N E S
$ { a r g _ P U B L I C _ D E F I N E S }
D E F I N E S
$ { a r g _ D E F I N E S }
P U B L I C _ L I B R A R I E S $ { a r g _ P U B L I C _ L I B R A R I E S }
L I B R A R I E S $ { a r g _ L I B R A R I E S } Q t : : P l a t f o r m M o d u l e I n t e r n a l
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
P U B L I C _ C O M P I L E _ O P T I O N S $ { a r g _ P U B L I C _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
P U B L I C _ L I N K _ O P T I O N S $ { a r g _ P U B L I C _ L I N K _ O P T I O N S }
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
$ { i n s t a l l _ a r g u m e n t s }
)
endfunction ( )
2020-02-11 14:38:47 +00:00
#
# This function replaces qmake's qt_helper_lib feature. It is intended to
# compile 3rdparty libraries as part of the build.
#
function ( qt_add_3rdparty_library target )
# Process arguments:
qt_parse_all_arguments ( arg "qt_add_3rdparty_library"
" S H A R E D ; M O D U L E ; S T A T I C ; I N T E R F A C E ; E X C E P T I O N S "
" O U T P U T _ D I R E C T O R Y "
" $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; $ { _ _ d e f a u l t _ p u b l i c _ a r g s } "
$ { A R G N }
)
### Define Targets:
if ( ${ arg_INTERFACE } )
add_library ( "${target}" INTERFACE )
elseif ( ${ arg_STATIC } OR ( ${ arg_MODULE } AND NOT BUILD_SHARED_LIBS ) )
add_library ( "${target}" STATIC )
elseif ( ${ arg_SHARED } )
add_library ( "${target}" SHARED )
elseif ( ${ arg_MODULE } )
add_library ( "${target}" MODULE )
set_property ( TARGET ${ name } PROPERTY C_VISIBILITY_PRESET default )
set_property ( TARGET ${ name } PROPERTY CXX_VISIBILITY_PRESET default )
if ( APPLE )
# CMake defaults to using .so extensions for loadable modules, aka plugins,
# but Qt plugins are actually suffixed with .dylib.
set_property ( TARGET "${target}" PROPERTY SUFFIX ".dylib" )
endif ( )
else ( )
add_library ( "${target}" )
endif ( )
if ( NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY )
set ( arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" )
endif ( )
qt_internal_add_qt_repo_known_module ( ${ target } )
qt_internal_add_target_aliases ( ${ target } )
if ( ANDROID )
qt_android_apply_arch_suffix ( "${target}" )
endif ( )
qt_skip_warnings_are_errors_when_repo_unclean ( "${target}" )
if ( NOT arg_HEADER_MODULE )
set_target_properties ( ${ target } PROPERTIES
L I B R A R Y _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ L I B D I R } "
R U N T I M E _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ B I N D I R } "
A R C H I V E _ O U T P U T _ D I R E C T O R Y " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ L I B D I R } "
V E R S I O N $ { P R O J E C T _ V E R S I O N }
S O V E R S I O N $ { P R O J E C T _ V E R S I O N _ M A J O R }
Q T _ M O D U L E _ I S _ 3 R D P A R T Y _ L I B R A R Y T R U E
)
qt_handle_multi_config_output_dirs ( "${target}" )
set_target_properties ( ${ target } PROPERTIES
O U T P U T _ N A M E " $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } "
)
endif ( )
if ( NOT arg_INTERFACE )
# This property is used for super builds with static libraries. We use
# it in QtPlugins.cmake.in to avoid "polluting" the dependency chain
# for the target in it's project directory.
# E.g: When we process find_package(Qt6 ... Gui) in QtDeclarative, the
# rules in QtPugins.cmake add all the known Gui plugins as interface
# dependencies. This in turn causes circular dependencies on every
# plugin which links against Gui. Plugin A -> GUI -> Plugin A ....
set_target_properties ( ${ target } PROPERTIES QT_BUILD_PROJECT_NAME ${ PROJECT_NAME } )
endif ( )
if ( NOT arg_EXCEPTIONS AND NOT arg_INTERFACE )
qt_internal_set_no_exceptions_flags ( "${target}" )
endif ( )
qt_extend_target ( "${target}"
S O U R C E S $ { a r g _ S O U R C E S }
I N C L U D E _ D I R E C T O R I E S
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
P U B L I C _ I N C L U D E _ D I R E C T O R I E S
$ { a r g _ P U B L I C _ I N C L U D E _ D I R E C T O R I E S }
P U B L I C _ D E F I N E S
$ { a r g _ P U B L I C _ D E F I N E S }
D E F I N E S
$ { a r g _ D E F I N E S }
P U B L I C _ L I B R A R I E S $ { a r g _ P U B L I C _ L I B R A R I E S }
L I B R A R I E S $ { a r g _ L I B R A R I E S }
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
P U B L I C _ C O M P I L E _ O P T I O N S $ { a r g _ P U B L I C _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
P U B L I C _ L I N K _ O P T I O N S $ { a r g _ P U B L I C _ L I N K _ O P T I O N S }
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
E N A B L E _ A U T O G E N _ T O O L S $ { a r g _ E N A B L E _ A U T O G E N _ T O O L S }
D I S A B L E _ A U T O G E N _ T O O L S $ { a r g _ D I S A B L E _ A U T O G E N _ T O O L S }
$ { i n s t a l l _ a r g u m e n t s }
)
if ( NOT BUILD_SHARED_LIBS OR arg_SHARED )
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 } )
set ( export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets" )
configure_package_config_file (
" $ { Q T _ C M A K E _ D I R } / Q t 3 r d P a r t y L i b r a r y C o n f i g . c m a k e . i n "
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g . c m a k e "
I N S T A L L _ D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
write_basic_package_version_file (
" $ { c o n f i g _ b u i l d _ d i r } / $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
)
qt_install ( TARGETS ${ target }
E X P O R T " $ { e x p o r t _ n a m e } "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
qt_install ( EXPORT ${ export_name }
N A M E S P A C E " $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : "
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
qt_internal_export_modern_cmake_config_targets_file (
T A R G E T S $ { t a r g e t }
E X P O R T _ N A M E _ P R E F I X $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { t a r g e t }
C O N F I G _ I N S T A L L _ D I R " $ { c o n f i g _ i n s t a l l _ d i r } "
)
endif ( )
endfunction ( )
2019-12-06 14:12:17 +00:00
function ( qt_get_tool_cmake_configuration out_var )
qt_get_main_cmake_configuration ( "${out_var}" )
string ( TOUPPER "${${out_var}}" upper_config )
set ( "${out_var}" "${upper_config}" PARENT_SCOPE )
endfunction ( )
function ( qt_get_main_cmake_configuration out_var )
if ( CMAKE_BUILD_TYPE )
set ( config "${CMAKE_BUILD_TYPE}" )
elseif ( QT_MULTI_CONFIG_FIRST_CONFIG )
set ( config "${QT_MULTI_CONFIG_FIRST_CONFIG}" )
endif ( )
set ( "${out_var}" "${config}" PARENT_SCOPE )
endfunction ( )
2018-10-24 13:20:27 +00:00
# This function is used to define a "Qt tool", such as moc, uic or rcc.
# The BOOTSTRAP option allows building it as standalone program, otherwise
# it will be linked against QtCore.
2019-11-13 13:03:20 +00:00
function ( qt_add_tool name )
qt_parse_all_arguments ( arg "qt_add_tool" "BOOTSTRAP;NO_QT;NO_INSTALL" "TOOLS_TARGET"
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
" $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } " $ { A R G N } )
# Handle case when a tool does not belong to a module and it can't be built either (like
# during a cross-compile).
if ( NOT arg_TOOLS_TARGET AND NOT QT_WILL_BUILD_TOOLS )
message ( FATAL_ERROR "The tool \" ${ name } \" has not been assigned to a module via "
" TOOLS_TARGET ( so it can't be found ) a n d i t c a n ' t b e b u i l t "
" ( Q T _ W I L L _ B U I L D _ T O O L S i s $ { Q T _ W I L L _ B U I L D _ T O O L S } ) . " )
endif ( )
set ( full_name "${QT_CMAKE_EXPORT_NAMESPACE}::${name}" )
if ( TARGET ${ full_name } )
get_property ( path TARGET ${ full_name } PROPERTY LOCATION )
message ( STATUS "Tool '${full_name}' was found at ${path}." )
2019-02-11 14:50:17 +00:00
return ( )
endif ( )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
if ( arg_TOOLS_TARGET AND NOT QT_WILL_BUILD_TOOLS )
2019-06-14 10:59:07 +00:00
set ( tools_package_name "Qt6${arg_TOOLS_TARGET}Tools" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
message ( STATUS "Searching for tool '${full_name}' in package ${tools_package_name}." )
# Only search in path provided by QT_HOST_PATH. We need to do it with CMAKE_PREFIX_PATH
# instead of PATHS option, because any find_dependency call inside a Tools package would
# not get the proper prefix when using PATHS.
set ( BACKUP_CMAKE_PREFIX_PATH ${ CMAKE_PREFIX_PATH } )
set ( CMAKE_PREFIX_PATH "${QT_HOST_PATH}" )
2019-05-03 10:07:37 +00:00
# Search both with sysroots prepended as well as in the host system. When cross compiling
2019-06-14 10:59:07 +00:00
# the mode_package might be set to ONLY only, and the Qt6 tools packages are actually
2019-05-03 10:07:37 +00:00
# in the host system.
set ( BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE } )
set ( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "BOTH" )
set ( BACKUP_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}" )
set ( CMAKE_SIZEOF_VOID_P "" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
find_package (
$ { t o o l s _ p a c k a g e _ n a m e }
$ { P R O J E C T _ V E R S I O N }
N O _ P A C K A G E _ R O O T _ P A T H
N O _ C M A K E _ E N V I R O N M E N T _ P A T H
N O _ S Y S T E M _ E N V I R O N M E N T _ P A T H
N O _ C M A K E _ P A C K A G E _ R E G I S T R Y
N O _ C M A K E _ S Y S T E M _ P A T H
N O _ C M A K E _ S Y S T E M _ P A C K A G E _ R E G I S T R Y )
2019-05-03 10:07:37 +00:00
set ( CMAKE_SIZEOF_VOID_P "${BACKUP_CMAKE_SIZEOF_VOID_P}" )
set ( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE "${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}" )
set ( CMAKE_PREFIX_PATH "${BACKUP_CMAKE_PREFIX_PATH}" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
if ( ${ ${tools_package_name } _FOUND} AND TARGET ${ full_name } )
2019-06-24 13:01:53 +00:00
# Even if the tool is already visible, make sure that our modules remain associated
# with the tools.
qt_internal_append_known_modules_with_tools ( "${arg_TOOLS_TARGET}" )
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
get_property ( path TARGET ${ full_name } PROPERTY LOCATION )
message ( STATUS "${full_name} was found at ${path} using package ${tools_package_name}." )
return ( )
endif ( )
endif ( )
if ( NOT QT_WILL_BUILD_TOOLS )
message ( FATAL_ERROR "The tool \" ${ full_name } \" was not found in the "
" $ { t o o l s _ p a c k a g e _ n a m e } p a c k a g e . "
" P a c k a g e f o u n d : $ { $ { t o o l s _ p a c k a g e _ n a m e } _ F O U N D } " )
else ( )
message ( STATUS "Tool '${full_name}' will be built from source." )
endif ( )
2018-10-24 13:20:27 +00:00
2019-03-06 12:51:38 +00:00
set ( disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}" )
2019-04-29 11:14:22 +00:00
if ( arg_NO_QT )
# FIXME: Remove NO_QT again once qmake can use a "normal" Qt!
if ( arg_BOOTSTRAP )
message ( FATAL_ERROR "Tool can not be NO_QT and BOOTSTRAP at the same time!" )
endif ( )
set ( corelib "" )
2018-10-24 13:20:27 +00:00
else ( )
2019-04-29 11:14:22 +00:00
if ( arg_BOOTSTRAP )
set ( corelib ${ QT_CMAKE_EXPORT_NAMESPACE } ::Bootstrap )
list ( APPEND disable_autogen_tools "uic" "moc" "rcc" )
else ( )
set ( corelib ${ QT_CMAKE_EXPORT_NAMESPACE } ::Core )
endif ( )
2018-10-24 13:20:27 +00:00
endif ( )
2019-03-20 11:09:12 +00:00
set ( bootstrap "" )
if ( arg_BOOTSTRAP )
set ( bootstrap BOOTSTRAP )
endif ( )
2019-04-29 14:32:21 +00:00
set ( no_qt "" )
if ( arg_NO_QT )
set ( no_qt NO_QT )
endif ( )
2019-04-03 09:33:28 +00:00
set ( no_install "" )
if ( arg_NO_INSTALL )
set ( no_install NO_INSTALL )
endif ( )
2019-11-13 13:03:20 +00:00
qt_add_executable ( "${name}" OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_BINDIR}"
2019-03-20 11:09:12 +00:00
$ { b o o t s t r a p }
2019-04-29 14:32:21 +00:00
$ { n o _ q t }
2019-04-03 09:33:28 +00:00
$ { n o _ i n s t a l l }
2018-12-12 09:55:20 +00:00
S O U R C E S $ { a r g _ S O U R C E S }
2018-10-24 13:20:27 +00:00
I N C L U D E _ D I R E C T O R I E S
2018-12-07 12:13:24 +00:00
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
D E F I N E S $ { a r g _ D E F I N E S }
2019-05-09 08:02:37 +00:00
P U B L I C _ L I B R A R I E S $ { c o r e l i b }
2019-06-05 14:05:50 +00:00
L I B R A R I E S $ { a r g _ L I B R A R I E S } Q t : : P l a t f o r m T o o l I n t e r n a l
2019-01-29 11:07:24 +00:00
C O M P I L E _ O P T I O N S $ { a r g _ C O M P I L E _ O P T I O N S }
L I N K _ O P T I O N S $ { a r g _ L I N K _ O P T I O N S }
2019-01-30 15:43:11 +00:00
M O C _ O P T I O N S $ { a r g _ M O C _ O P T I O N S }
2019-03-06 12:51:38 +00:00
D I S A B L E _ A U T O G E N _ T O O L S $ { d i s a b l e _ a u t o g e n _ t o o l s }
2018-10-24 13:20:27 +00:00
)
2018-12-07 12:48:36 +00:00
qt_internal_add_target_aliases ( "${name}" )
2018-10-24 13:20:27 +00:00
2019-12-06 14:12:17 +00:00
# If building with a multi-config configuration, the main configuration tool will be placed in
# ./bin, while the rest will be in <CONFIG> specific subdirectories.
qt_get_tool_cmake_configuration ( tool_cmake_configuration )
2019-06-20 08:56:19 +00:00
set_target_properties ( "${name}" PROPERTIES
2019-12-06 14:12:17 +00:00
R U N T I M E _ O U T P U T _ D I R E C T O R Y _ $ { t o o l _ c m a k e _ c o n f i g u r a t i o n } " $ { Q T _ B U I L D _ D I R } / $ { I N S T A L L _ B I N D I R } "
2019-06-20 08:56:19 +00:00
)
Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.
Third party projects that require just these tools, and not the Qt
modules themselves, should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.
It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.
Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.
This commit also changes the behavior regarding when to build tools
while building Qt itself.
When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.
When not cross compiling, tools added by add_qt_tool are built from
source.
When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.
Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.
Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools
Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-10 17:21:22 +00:00
if ( NOT arg_NO_INSTALL AND arg_TOOLS_TARGET )
# Assign a tool to an export set, and mark the module to which the tool belongs.
qt_internal_append_known_modules_with_tools ( "${arg_TOOLS_TARGET}" )
# Also append the tool to the module list.
qt_internal_append_known_module_tool ( "${arg_TOOLS_TARGET}" "${name}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( TARGETS "${name}"
E X P O R T " $ { I N S T A L L _ C M A K E _ N A M E S P A C E } $ { a r g _ T O O L S _ T A R G E T } T o o l s T a r g e t s "
D E S T I N A T I O N $ { I N S T A L L _ T A R G E T S _ D E F A U L T _ A R G S } )
2019-04-03 09:33:28 +00:00
endif ( )
2018-10-24 13:20:27 +00:00
endfunction ( )
function ( qt_create_tracepoints name tracePointsFile )
#### TODO
string ( TOLOWER "${name}" name )
file ( GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/qt${name}_tracepoints_p.h" CONTENT
" #include <private/qtrace_p.h>")
endfunction ( )
2019-03-11 14:09:33 +00:00
# Handle files that need special SIMD-related flags.
# This creates an object library and makes target link
# to it (privately).
2019-11-13 13:03:20 +00:00
function ( qt_add_simd_part target )
qt_parse_all_arguments ( arg "qt_add_simd_part" "" ""
2019-03-11 14:09:33 +00:00
" N A M E ; S I M D ; $ { _ _ d e f a u l t _ p r i v a t e _ a r g s } ; C O M P I L E _ F L A G S " $ { A R G N } )
if ( "x${arg_SIMD}" STREQUAL x )
2019-11-13 13:03:20 +00:00
message ( FATAL_ERROR "qt_add_simd_part needs a SIMD type to be set." )
2019-03-11 14:09:33 +00:00
endif ( )
set ( condition "QT_FEATURE_${arg_SIMD}" )
if ( "${arg_SIMD}" STREQUAL arch_haswell )
set ( condition "TEST_subarch_avx2 AND TEST_subarch_bmi AND TEST_subarch_bmi2 AND TEST_subarch_f16c AND TEST_subarch_fma AND TEST_subarch_lzcnt AND TEST_subarch_popcnt" )
elseif ( "${arg_SIMD}" STREQUAL avx512common )
set ( condition "TEST_subarch_avx512cd" )
elseif ( "${arg_SIMD}" STREQUAL avx512core )
set ( condition "TEST_subarch_avx512cd AND TEST_subarch_avx512bw AND TEST_subarch_avx512dq AND TEST_subarch_avx512vl" )
endif ( )
set ( name "${arg_NAME}" )
if ( "x${name}" STREQUAL x )
set ( name "${target}_simd_${arg_SIMD}" )
endif ( )
qt_evaluate_config_expression ( result ${ condition } )
if ( ${ result } )
if ( QT_CMAKE_DEBUG_EXTEND_TARGET )
2019-11-13 13:03:20 +00:00
message ( "qt_add_simd_part(${target} SIMD ${arg_SIMD} ...): Evaluated" )
2019-03-11 14:09:33 +00:00
endif ( )
string ( TOUPPER "QT_CFLAGS_${arg_SIMD}" simd_flags )
2019-11-11 12:38:13 +00:00
if ( NOT TARGET "${name}" )
add_library ( "${name}" OBJECT )
endif ( )
2019-03-11 14:09:33 +00:00
target_sources ( "${name}" PRIVATE ${ arg_SOURCES } )
target_include_directories ( "${name}" PRIVATE
$ { a r g _ I N C L U D E _ D I R E C T O R I E S }
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , I N C L U D E _ D I R E C T O R I E S > )
target_compile_options ( "${name}" PRIVATE
$ { $ { s i m d _ f l a g s } }
$ { a r g _ C O M P I L E _ F L A G S }
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , C O M P I L E _ O P T I O N S > )
target_compile_definitions ( "${name}" PRIVATE
$ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , C O M P I L E _ D E F I N I T I O N S > )
target_link_libraries ( "${target}" PRIVATE "${name}" )
2019-02-11 11:12:07 +00:00
2020-01-20 17:07:00 +00:00
# Add a link-only dependency on the parent library, to force copying of framework headers
# before trying to compile a source file.
target_link_libraries ( "${name}" PRIVATE
$ < F I L T E R : $ < T A R G E T _ P R O P E R T Y : $ { t a r g e t } , L I N K _ L I B R A R I E S > , E X C L U D E , ^ $ { t a r g e t } _ s i m d _ > )
2019-02-11 11:12:07 +00:00
if ( NOT BUILD_SHARED_LIBS )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install (
2019-02-11 11:12:07 +00:00
T A R G E T S $ { n a m e }
E X P O R T " $ { I N S T A L L _ C M A K E _ N A M E S P A C E } T a r g e t s "
)
endif ( )
2019-03-11 14:09:33 +00:00
else ( )
if ( QT_CMAKE_DEBUG_EXTEND_TARGET )
2019-11-13 13:03:20 +00:00
message ( "qt_add_simd_part(${target} SIMD ${arg_SIMD} ...): Skipped" )
2019-03-11 14:09:33 +00:00
endif ( )
endif ( )
endfunction ( )
2019-06-14 10:59:07 +00:00
# From Qt6CoreMacros
2018-10-24 13:20:27 +00:00
# Function used to create the names of output files preserving relative dirs
2018-11-08 21:29:27 +00:00
function ( qt_make_output_file infile prefix suffix source_dir binary_dir result )
get_filename_component ( outfilename "${infile}" NAME_WE )
set ( base_dir "${source_dir}" )
string ( FIND "${infile}" "${binary_dir}/" in_binary )
if ( in_binary EQUAL 0 )
set ( base_dir "${binary_dir}" )
2018-10-24 13:20:27 +00:00
endif ( )
2018-11-08 21:29:27 +00:00
get_filename_component ( abs_infile "${infile}" ABSOLUTE BASE_DIR "${base_dir}" )
file ( RELATIVE_PATH rel_infile "${base_dir}" "${abs_infile}" )
string ( REPLACE "../" "__/" mapped_infile "${rel_infile}" )
get_filename_component ( abs_mapped_infile "${mapped_infile}" ABSOLUTE BASE_DIR "${binary_dir}" )
get_filename_component ( outpath "${abs_mapped_infile}" PATH )
2018-10-24 13:20:27 +00:00
file ( MAKE_DIRECTORY "${outpath}" )
2018-12-07 12:13:24 +00:00
set ( "${result}" "${outpath}/${prefix}${outfilename}${suffix}" PARENT_SCOPE )
2018-10-24 13:20:27 +00:00
endfunction ( )
2018-11-08 21:29:27 +00:00
2018-12-12 09:55:20 +00:00
# Complete manual moc invocation with full control.
# Use AUTOMOC whenever possible.
function ( qt_manual_moc result )
2020-02-03 15:52:18 +00:00
cmake_parse_arguments ( arg "" "OUTPUT_MOC_JSON_FILES" "FLAGS" ${ ARGN } )
2018-12-12 09:55:20 +00:00
set ( moc_files )
2020-02-03 15:52:18 +00:00
set ( metatypes_json_list )
2018-12-12 09:55:20 +00:00
foreach ( infile ${ arg_UNPARSED_ARGUMENTS } )
qt_make_output_file ( "${infile}" "moc_" ".cpp"
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } " " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " o u t f i l e )
list ( APPEND moc_files "${outfile}" )
2018-10-24 13:20:27 +00:00
2018-12-12 09:55:20 +00:00
set ( moc_parameters_file "${outfile}_parameters$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>" )
set ( moc_parameters ${ arg_FLAGS } -o "${outfile}" "${infile}" )
2020-02-03 15:52:18 +00:00
set ( metatypes_byproducts )
if ( arg_OUTPUT_MOC_JSON_FILES )
set ( moc_json_file "${outfile}.json" )
list ( APPEND moc_parameters --output-json )
list ( APPEND metatypes_json_list "${outfile}.json" )
set ( metatypes_byproducts "${outfile}.json" )
endif ( )
2018-12-12 09:55:20 +00:00
string ( REPLACE ";" "\n" moc_parameters "${moc_parameters}" )
2018-10-24 13:20:27 +00:00
2018-12-12 09:55:20 +00:00
file ( GENERATE OUTPUT "${moc_parameters_file}" CONTENT "${moc_parameters}\n" )
2018-10-24 13:20:27 +00:00
2020-02-03 15:52:18 +00:00
add_custom_command ( OUTPUT "${outfile}" ${ metatypes_byproducts }
2019-02-12 09:02:15 +00:00
C O M M A N D $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : m o c " @ $ { m o c _ p a r a m e t e r s _ f i l e } "
D E P E N D S " $ { i n f i l e } " $ { m o c _ d e p e n d s } $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : m o c
2018-12-12 09:55:20 +00:00
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } " V E R B A T I M )
2018-10-24 13:20:27 +00:00
endforeach ( )
2018-12-12 09:55:20 +00:00
set ( "${result}" ${ moc_files } PARENT_SCOPE )
2020-02-03 15:52:18 +00:00
# Register generated json files
if ( arg_OUTPUT_MOC_JSON_FILES )
set ( ${ arg_OUTPUT_MOC_JSON_FILES } "${metatypes_json_list}" PARENT_SCOPE )
endif ( )
2018-10-24 13:20:27 +00:00
endfunction ( )
2018-10-29 15:53:51 +00:00
# helper to set up a qdbusxml2cpp rule
function ( qt_create_qdbusxml2cpp_command target infile )
2019-01-30 13:06:48 +00:00
qt_parse_all_arguments ( arg "qt_create_qdbusxml2cpp_command" "ADAPTOR;INTERFACE" "BASENAME" "FLAGS" ${ ARGN } )
2018-12-07 12:13:24 +00:00
if ( ( arg_ADAPTOR AND arg_INTERFACE ) OR ( NOT arg_ADAPTOR AND NOT arg_INTERFACE ) )
2018-10-29 15:53:51 +00:00
message ( FATAL_ERROR "qt_create_dbusxml2cpp_command needs either ADAPTOR or INTERFACE." )
endif ( )
2018-12-07 12:13:24 +00:00
set ( option "-a" )
set ( type "adaptor" )
if ( arg_INTERFACE )
set ( option "-p" )
set ( type "interface" )
2018-10-29 15:53:51 +00:00
endif ( )
2019-01-30 13:06:48 +00:00
if ( "${arg_BASENAME}" STREQUAL "" )
2019-03-18 18:10:28 +00:00
get_filename_component ( file_dir "${infile}" DIRECTORY )
get_filename_component ( file_name "${infile}" NAME_WLE )
get_filename_component ( file_ext "${infile}" LAST_EXT )
if ( "${file_ext}" STREQUAL ".xml" )
else ( )
message ( FATAL_ERROR "DBUS ${type} input file is not xml." )
endif ( )
# use last part of io.qt.something.xml!
get_filename_component ( file_ext "${file_name}" LAST_EXT )
if ( "x${file_ext}" STREQUAL "x" )
else ( )
string ( SUBSTRING "${file_ext}" 1 -1 file_name ) # cut of leading '.'
endif ( )
2019-01-30 13:06:48 +00:00
string ( TOLOWER "${file_name}" file_name )
set ( file_name "${file_name}_${type}" )
else ( )
set ( file_name ${ arg_BASENAME } )
endif ( )
2019-04-16 10:53:24 +00:00
# Use absolute file path for the source file and set the current working directory to the
# current binary directory, because setting an absolute path for the header:source combo option
# does not work. Splitting on ":" breaks inside the dbus tool when running on Windows
# due to ":" being contained in the drive path (e.g C:\foo.h:C:\foo.cpp).
get_filename_component ( absolute_in_file_path "${infile}" ABSOLUTE )
2018-10-29 15:53:51 +00:00
2019-04-16 10:53:24 +00:00
set ( header_file "${file_name}.h" )
set ( source_file "${file_name}.cpp" )
2018-10-29 15:53:51 +00:00
add_custom_command ( OUTPUT "${header_file}" "${source_file}"
2019-04-16 10:53:24 +00:00
C O M M A N D $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : q d b u s x m l 2 c p p $ { a r g _ F L A G S } " $ { o p t i o n } "
" $ { h e a d e r _ f i l e } : $ { s o u r c e _ f i l e } " " $ { a b s o l u t e _ i n _ f i l e _ p a t h } "
2020-01-31 13:44:52 +00:00
D E P E N D S " $ { a b s o l u t e _ i n _ f i l e _ p a t h } " $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : q d b u s x m l 2 c p p
2019-04-16 10:53:24 +00:00
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
2018-10-29 15:53:51 +00:00
V E R B A T I M )
2018-12-12 09:55:20 +00:00
target_sources ( "${target}" PRIVATE "${header_file}" "${source_file}" )
2018-10-29 15:53:51 +00:00
endfunction ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
function ( qt_compute_injection_forwarding_header target )
qt_parse_all_arguments ( arg "qt_compute_injection_forwarding_header"
" P R I V A T E " " S O U R C E ; O U T _ V A R " " " $ { A R G N } )
2018-12-07 13:04:42 +00:00
qt_internal_module_info ( module "${target}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
get_filename_component ( file_name "${arg_SOURCE}" NAME )
2018-10-24 13:20:27 +00:00
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( source_absolute_path "${CMAKE_CURRENT_BINARY_DIR}/${arg_SOURCE}" )
2019-11-21 12:33:28 +00:00
file ( RELATIVE_PATH relpath "${PROJECT_BINARY_DIR}" "${source_absolute_path}" )
2018-10-24 13:20:27 +00:00
2018-12-07 12:13:24 +00:00
if ( arg_PRIVATE )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( fwd "${PROJECT_VERSION}/${module}/private/${file_name}" )
2018-10-24 13:20:27 +00:00
else ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( fwd "${file_name}" )
2018-10-24 13:20:27 +00:00
endif ( )
2019-06-14 13:29:21 +00:00
string ( APPEND ${ arg_OUT_VAR } " ${relpath}:${fwd}" )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( ${ arg_OUT_VAR } ${ ${arg_OUT_VAR } } PARENT_SCOPE )
2018-10-24 13:20:27 +00:00
endfunction ( )
2019-11-13 13:03:20 +00:00
function ( qt_add_docs )
2019-09-18 07:27:22 +00:00
if ( ${ ARGC } EQUAL 1 )
# Function called from old generated CMakeLists.txt that was missing the target parameter
return ( )
endif ( )
if ( NOT ${ ARGC } EQUAL 2 )
2019-11-13 13:03:20 +00:00
message ( FATAL_ERROR "qt_add_docs called with the wrong number of arguments. Should be qt_add_docs(target path_to_project.qdocconf)." )
2019-09-18 07:27:22 +00:00
return ( )
endif ( )
set ( target ${ ARGV0 } )
set ( doc_project ${ ARGV1 } )
2019-09-19 07:38:09 +00:00
2019-11-21 12:33:28 +00:00
if ( NOT QT_SUPERBUILD OR QT_WILL_INSTALL )
2020-01-21 14:02:58 +00:00
set ( qdoc_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qdoc" )
set ( qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qtattributionsscanner" )
set ( qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qhelpgenerator" )
2019-11-21 12:33:28 +00:00
else ( )
2020-01-21 14:02:58 +00:00
set ( qdoc_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qdoc" )
set ( qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qtattributionsscanner" )
set ( qhelpgenerator_bin "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_BINDIR}/qhelpgenerator" )
2019-11-21 12:33:28 +00:00
endif ( )
2019-09-19 07:38:09 +00:00
get_target_property ( target_type ${ target } TYPE )
if ( NOT target_type STREQUAL "INTERFACE_LIBRARY" )
get_target_property ( target_bin_dir ${ target } BINARY_DIR )
get_target_property ( target_source_dir ${ target } SOURCE_DIR )
else ( )
set ( target_bin_dir ${ CMAKE_CURRENT_BINARY_DIR } )
set ( target_source_dir ${ CMAKE_CURRENT_SOURCE_DIR } )
endif ( )
set ( doc_ouput_dir "${target_bin_dir}/.doc" )
# Generate include dir list
2019-12-06 14:12:17 +00:00
set ( target_include_dirs_file "${doc_ouput_dir}/$<CONFIG>/includes.txt" )
2019-09-19 07:38:09 +00:00
set ( include_paths_property "$<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>" )
if ( NOT target_type STREQUAL "INTERFACE_LIBRARY" )
file ( GENERATE
O U T P U T $ { t a r g e t _ i n c l u d e _ d i r s _ f i l e }
C O N T E N T " - I $ < J O I N : $ { i n c l u d e _ p a t h s _ p r o p e r t y } , \ n - I > "
)
set ( include_path_args "@${target_include_dirs_file}" )
else ( )
set ( include_path_args "" )
endif ( )
get_filename_component ( doc_target "${doc_project}" NAME_WLE )
if ( QT_WILL_INSTALL )
2020-02-07 16:02:27 +00:00
set ( qdoc_output_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}/${doc_target}" )
set ( index_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}" )
2019-11-21 12:33:28 +00:00
elseif ( QT_SUPERBUILD )
2020-02-07 16:02:27 +00:00
set ( qdoc_output_dir "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_DOCDIR}/${doc_target}" )
set ( index_dir "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_DOCDIR}" )
2019-09-19 07:38:09 +00:00
else ( )
2020-02-07 16:02:27 +00:00
set ( qdoc_output_dir "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}" )
set ( index_dir "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}" )
2019-09-19 07:38:09 +00:00
endif ( )
# qtattributionsscanner
add_custom_target ( qattributionsscanner_ ${ target }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { q a t t r i b u t i o n s s c a n n e r _ b i n }
2019-09-19 07:38:09 +00:00
C O M M A N D $ { q t a t t r i b u t i o n s s c a n n e r _ b i n }
$ { P R O J E C T _ S O U R C E _ D I R }
- - f i l t e r " Q D o c M o d u l e = $ { q d o c _ t a r g e t } "
- o " $ { t a r g e t _ b i n _ d i r } / c o d e a t t r i b u t i o n s . q d o c "
)
# prepare docs target
set ( prepare_qdoc_args
- o u t p u t d i r " $ { q d o c _ o u t p u t _ d i r } "
2020-02-07 16:02:27 +00:00
- i n s t a l l d i r " $ { Q T _ I N S T A L L _ D I R } / $ { I N S T A L L _ D O C D I R } "
2019-09-19 07:38:09 +00:00
" $ { t a r g e t _ s o u r c e _ d i r } / $ { d o c _ p r o j e c t } "
- p r e p a r e
- i n d e x d i r " $ { i n d e x _ d i r } "
- n o - l i n k - e r r o r s
" $ { i n c l u d e _ p a t h _ a r g s } "
)
2019-11-21 12:33:28 +00:00
if ( QT_SUPERBUILD AND NOT QT_WILL_INSTALL )
2020-02-07 16:02:27 +00:00
set ( qt_install_docs_env "${CMAKE_INSTALL_PREFIX}/qtbase/${INSTALL_DOCDIR}" )
2019-11-21 12:33:28 +00:00
else ( )
2020-02-07 16:02:27 +00:00
set ( qt_install_docs_env "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}" )
2019-11-21 12:33:28 +00:00
endif ( )
2019-09-19 07:38:09 +00:00
set ( qdoc_env_args
2019-11-21 12:33:28 +00:00
" Q T _ I N S T A L L _ D O C S = \ " $ { q t _ i n s t a l l _ d o c s _ e n v } \ " "
2019-09-19 07:38:09 +00:00
" Q T _ V E R S I O N = $ { P R O J E C T _ V E R S I O N _ M A J O R } . $ { P R O J E C T _ V E R S I O N _ M I N O R } . $ { P R O J E C T _ V E R S I O N _ P A T C H } "
" Q T _ V E R = $ { P R O J E C T _ V E R S I O N _ M A J O R } . $ { P R O J E C T _ V E R S I O N _ M I N O R } "
" Q T _ V E R S I O N _ T A G = $ { P R O J E C T _ V E R S I O N _ M A J O R } $ { P R O J E C T _ V E R S I O N _ M I N O R } $ { P R O J E C T _ V E R S I O N _ P A T C H } "
" B U I L D D I R = $ { t a r g e t _ b i n _ d i r } "
)
add_custom_target ( prepare_docs_ ${ target }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { q d o c _ b i n }
2019-09-19 07:38:09 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v $ { q d o c _ e n v _ a r g s }
$ { q d o c _ b i n }
$ { p r e p a r e _ q d o c _ a r g s }
)
add_dependencies ( prepare_docs_ ${ target } qattributionsscanner_ ${ target } )
# generate docs target
set ( generate_qdocs_args
- o u t p u t d i r " $ { q d o c _ o u t p u t _ d i r } "
- i n s t a l l d i r " $ { I N S T A L L _ D O C D I R } "
" $ { t a r g e t _ s o u r c e _ d i r } / $ { d o c _ p r o j e c t } "
- g e n e r a t e
- i n d e x d i r " $ { i n d e x _ d i r } "
" $ { i n c l u d e _ p a t h _ a r g s } "
)
add_custom_target ( generate_docs_ ${ target }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { q d o c _ b i n }
2019-09-19 07:38:09 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v $ { q d o c _ e n v _ a r g s }
$ { q d o c _ b i n }
$ { g e n e r a t e _ q d o c s _ a r g s }
)
add_dependencies ( generate_docs_ ${ target } prepare_docs_ ${ target } )
# generate html
set ( html_qdocs_args
- o u t p u t d i r " $ { q d o c _ o u t p u t _ d i r } "
- i n s t a l l d i r " $ { I N S T A L L _ D O C D I R } "
" $ { t a r g e t _ s o u r c e _ d i r } / $ { d o c _ p r o j e c t } "
- i n d e x d i r " $ { i n d e x _ d i r } "
" $ { i n c l u d e _ p a t h _ a r g s } "
)
add_custom_target ( html_docs_ ${ target }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { q d o c _ b i n }
2019-09-19 07:38:09 +00:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E e n v $ { q d o c _ e n v _ a r g s }
$ { q d o c _ b i n }
$ { h t m l _ q d o c s _ a r g s }
)
add_dependencies ( html_docs_ ${ target } generate_docs_ ${ target } )
# generate .qch
set ( qch_file_name ${ doc_target } .qch )
set ( qch_file_path ${ qdoc_output_dir } / ${ qch_file_name } )
add_custom_target ( qch_docs_ ${ target }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { q h e l p g e n e r a t o r _ b i n }
2019-09-19 07:38:09 +00:00
C O M M A N D $ { q h e l p g e n e r a t o r _ b i n }
" $ { q d o c _ o u t p u t _ d i r } / $ { d o c _ t a r g e t } . q h p "
- o " $ { q c h _ f i l e _ p a t h } "
)
add_dependencies ( qch_docs_ ${ target } generate_docs_ ${ target } )
if ( QT_WILL_INSTALL )
add_custom_target ( install_html_docs_ ${ target }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y
" $ { q d o c _ o u t p u t _ d i r } "
" $ { C M A K E _ I N S T A L L _ P R E F I X } / $ { I N S T A L L _ D O C D I R } / $ { d o c _ t a r g e t } "
2020-02-07 16:02:27 +00:00
C O M M E N T " I n s t a l l i n g h t m l d o c s f o r t a r g e t $ { t a r g e t } "
2019-09-19 07:38:09 +00:00
)
add_custom_target ( install_qch_docs_ ${ target }
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t
" $ { q c h _ f i l e _ p a t h } "
" $ { C M A K E _ I N S T A L L _ P R E F I X } / $ { I N S T A L L _ D O C D I R } / $ { q c h _ f i l e _ n a m e } "
C O M M E N T " I n s t a l l i n g q c h d o c s f o r t a r g e t $ { t a r g e t } "
)
else ( )
# Don't need to do anything when not installing
add_custom_target ( install_html_docs_ ${ target } )
add_custom_target ( install_qch_docs_ ${ target } )
endif ( )
add_dependencies ( install_html_docs_ ${ target } html_docs_ ${ target } )
add_dependencies ( install_qch_docs_ ${ target } qch_docs_ ${ target } )
add_custom_target ( install_docs_ ${ target } )
add_dependencies ( install_docs_ ${ target } install_html_docs_ ${ target } install_qch_docs_ ${ target } )
add_dependencies ( ${ qt_docs_prepare_target_name } prepare_docs_ ${ target } )
add_dependencies ( ${ qt_docs_generate_target_name } generate_docs_ ${ target } )
add_dependencies ( ${ qt_docs_html_target_name } html_docs_ ${ target } )
add_dependencies ( ${ qt_docs_qch_target_name } qch_docs_ ${ target } )
add_dependencies ( ${ qt_docs_install_html_target_name } install_html_docs_ ${ target } )
add_dependencies ( ${ qt_docs_install_qch_target_name } install_qch_docs_ ${ target } )
add_dependencies ( ${ qt_docs_install_target_name } install_docs_ ${ target } )
2018-10-24 13:20:27 +00:00
endfunction ( )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
macro ( qt_find_package )
# Get the target names we expect to be provided by the package.
2019-05-03 13:46:02 +00:00
set ( options CONFIG NO_MODULE MODULE REQUIRED )
set ( oneValueArgs )
set ( multiValueArgs PROVIDED_TARGETS COMPONENTS )
cmake_parse_arguments ( arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ ARGN } )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
2019-10-01 13:22:27 +00:00
# If some Qt internal project calls qt_find_package(WrapFreeType), but WrapFreeType was already
# found as part of a find_dependency() call from a ModuleDependencies.cmake file (or similar),
# and the provided target is also found, that means this might have been an unnecessary
# qt_find_package() call, because the dependency was already found via some other transitive
# dependency. Return early, so that CMake doesn't fail wiht an error with trying to promote the
# targets to be global. This behavior is not enabled by default, because there are cases
# when a regular find_package() (non qt_) can find a package (Freetype -> PNG), and a subsequent
# qt_find_package(PNG PROVIDED_TARGET PNG::PNG) still needs to succeed and register the provided
# targets. To enable the debugging behavior, set QT_DEBUG_QT_FIND_PACKAGE to 1.
set ( _qt_find_package_skip_find_package FALSE )
if ( QT_DEBUG_QT_FIND_PACKAGE AND ${ ARGV0 } _FOUND AND arg_PROVIDED_TARGETS )
set ( _qt_find_package_skip_find_package TRUE )
foreach ( qt_find_package_target_name ${ arg_PROVIDED_TARGETS } )
if ( NOT TARGET ${ qt_find_package_target_name } )
set ( _qt_find_package_skip_find_package FALSE )
endif ( )
endforeach ( )
if ( _qt_find_package_skip_find_package )
message ( AUTHOR_WARNING "qt_find_package(${ARGV0}) called even though the package "
" w a s a l r e a d y f o u n d . C o n s i d e r r e m o v i n g t h e c a l l . " )
endif ( )
endif ( )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
# Get the version if specified.
set ( package_version "" )
if ( ${ ARGC } GREATER_EQUAL 2 )
if ( ${ ARGV1 } MATCHES "^[0-9\.]+$" )
set ( package_version "${ARGV1}" )
endif ( )
endif ( )
if ( arg_COMPONENTS )
# Re-append components to forward them.
list ( APPEND arg_UNPARSED_ARGUMENTS "COMPONENTS;${arg_COMPONENTS}" )
endif ( )
2019-10-01 13:22:27 +00:00
if ( NOT ( arg_CONFIG OR arg_NO_MODULE OR arg_MODULE ) AND NOT _qt_find_package_skip_find_package )
2019-05-03 13:46:02 +00:00
# Try to find a config package first in quiet mode
set ( config_package_arg ${ arg_UNPARSED_ARGUMENTS } )
list ( APPEND config_package_arg "CONFIG;QUIET" )
find_package ( ${ config_package_arg } )
2019-06-03 09:06:07 +00:00
# Double check that in config mode the targets become visible. Sometimes
# only the module mode creates the targets. For example with vcpkg, the sqlite
# package provides sqlite3-config.cmake, which offers multi-config targets but
# in their own way. CMake has FindSQLite3.cmake and with the original
# qt_find_package(SQLite3) call it is our intention to use the cmake package
# in module mode.
if ( ${ ARGV0 } _FOUND AND arg_PROVIDED_TARGETS )
2019-06-05 09:45:23 +00:00
unset ( any_target_found )
2019-06-03 09:06:07 +00:00
foreach ( expected_target ${ arg_PROVIDED_TARGETS } )
if ( TARGET ${ expected_target } )
set ( any_target_found TRUE )
break ( )
endif ( )
endforeach ( )
if ( NOT any_target_found )
2019-06-05 09:45:23 +00:00
unset ( ${ ARGV0 } _FOUND )
2019-06-03 09:06:07 +00:00
endif ( )
endif ( )
2019-05-03 13:46:02 +00:00
endif ( )
# Ensure the options are back in the original unparsed arguments
foreach ( opt IN LISTS options )
if ( arg_ ${ opt } )
list ( APPEND arg_UNPARSED_ARGUMENTS ${ opt } )
endif ( )
endforeach ( )
2019-10-01 13:22:27 +00:00
if ( NOT ${ ARGV0 } _FOUND AND NOT _qt_find_package_skip_find_package )
2019-09-27 11:29:47 +00:00
# Unset the NOTFOUND ${package}_DIR var that might have been set by the previous
# find_package call, to get rid of "not found" messagees in the feature summary
# if the package is found by the next find_package call.
if ( DEFINED CACHE{ ${ ARGV0 } _DIR} AND NOT ${ ARGV0 } _DIR )
unset ( ${ ARGV0 } _DIR CACHE )
endif ( )
2019-05-03 13:46:02 +00:00
# Call original function without our custom arguments.
find_package ( ${ arg_UNPARSED_ARGUMENTS } )
endif ( )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
2019-10-01 13:22:27 +00:00
if ( ${ ARGV0 } _FOUND AND arg_PROVIDED_TARGETS AND NOT _qt_find_package_skip_find_package )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
# If package was found, associate each target with its package name. This will be used
# later when creating Config files for Qt libraries, to generate correct find_dependency()
# calls. Also make the provided targets global, so that the properties can be read in
# all scopes.
foreach ( qt_find_package_target_name ${ arg_PROVIDED_TARGETS } )
if ( TARGET ${ qt_find_package_target_name } )
2019-06-04 10:02:14 +00:00
# Allow usage of aliased targets by setting properties on the actual target
get_target_property ( aliased_target ${ qt_find_package_target_name } ALIASED_TARGET )
if ( aliased_target )
set ( qt_find_package_target_name ${ aliased_target } )
endif ( )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
set_target_properties ( ${ qt_find_package_target_name }
P R O P E R T I E S I N T E R F A C E _ Q T _ P A C K A G E _ N A M E $ { A R G V 0 } )
if ( package_version )
set_target_properties ( ${ qt_find_package_target_name }
P R O P E R T I E S I N T E R F A C E _ Q T _ P A C K A G E _ V E R S I O N $ { A R G V 1 } )
endif ( )
if ( arg_COMPONENTS )
2019-06-25 12:44:29 +00:00
string ( REPLACE ";" " " components_as_string "${arg_COMPONENTS}" )
set_property ( TARGET ${ qt_find_package_target_name }
P R O P E R T Y I N T E R F A C E _ Q T _ P A C K A G E _ C O M P O N E N T S $ { c o m p o n e n t s _ a s _ s t r i n g } )
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
endif ( )
get_property ( is_global TARGET ${ qt_find_package_target_name } PROPERTY
I M P O R T E D _ G L O B A L )
if ( NOT is_global )
set_property ( TARGET ${ qt_find_package_target_name } PROPERTY
I M P O R T E D _ G L O B A L T R U E )
endif ( )
endif ( )
endforeach ( )
endif ( )
endmacro ( )
2019-02-11 11:12:07 +00:00
# Creates a simple export set for the various Find* dependencies
# which are needed when creating a static build of Qt.
# This introduces a custom target property: INTERFACE_QT_EXPORTED_LIBRARY
# This target property indicates that Qt modules / plugins using this 3rd party library
# must add it to their list of dependencies when creating their own ${qtmodule}Config.cmake
function ( qt_install_static_target_export target )
if ( BUILD_SHARED_LIBS )
return ( )
endif ( )
qt_parse_all_arguments ( arg "qt_install_3rdparty_config_files" "" "EXPORT" "" ${ ARGN } )
# TODO mark EXPORT as required
set_target_properties ( ${ target }
P R O P E R T I E S
I N T E R F A C E _ Q T _ E X P O R T E D _ L I B R A R Y 1 )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_path_join ( config_install_dir ${ QT_CONFIG_INSTALL_DIR } ${ arg_EXPORT } )
set ( export_name "${arg_EXPORT}Targets" )
qt_install (
2019-02-11 11:12:07 +00:00
T A R G E T S $ { t a r g e t }
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
E X P O R T $ { e x p o r t _ n a m e }
2019-02-11 11:12:07 +00:00
L I B R A R Y D E S T I N A T I O N $ { I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { I N S T A L L _ L I B D I R } )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install (
E X P O R T $ { e x p o r t _ n a m e }
2019-02-11 11:12:07 +00:00
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
endfunction ( )
# Create a set of ${target}Config.cmake and ${target}Version.cmake for a
# third-party library so that it can be found by client code linking statically.
function ( qt_install_3rdparty_config_files target )
if ( BUILD_SHARED_LIBS )
return ( )
endif ( )
qt_parse_all_arguments ( arg "qt_install_3rdparty_config_files" "" "EXPORT" "PACKAGES;ADDITIONAL_FILES" ${ ARGN } )
# TODO mark EXPORT as required
set ( 3RDPARTY_ADDITIONAL_SETUP_CODE )
foreach ( package ${ arg_PACKAGES } )
list ( APPEND 3RDPARTY_ADDITIONAL_SETUP_CODE "find_package(${package})\n" )
endforeach ( )
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
set ( path_suffix "${arg_EXPORT}" )
qt_path_join ( config_build_dir ${ QT_CONFIG_BUILD_DIR } ${ path_suffix } )
qt_path_join ( config_install_dir ${ QT_CONFIG_INSTALL_DIR } ${ path_suffix } )
2019-02-11 11:12:07 +00:00
configure_package_config_file (
" $ { P R O J E C T _ S O U R C E _ D I R } / c m a k e / 3 r d p a r t y C o n f i g . c m a k e . i n "
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g . c m a k e "
2019-02-11 11:12:07 +00:00
I N S T A L L _ D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
)
write_basic_package_version_file (
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
2019-02-11 11:12:07 +00:00
V E R S I O N $ { P R O J E C T _ V E R S I O N }
C O M P A T I B I L I T Y A n y N e w e r V e r s i o n
)
Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.
To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).
When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.
Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).
This patch stops installation of any files by forcing the
make "install" target be a no-op.
When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.
The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.
As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.
Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.
The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.
All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.
When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.
Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.
Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:45:41 +00:00
qt_install ( FILES
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g . c m a k e "
" $ { c o n f i g _ b u i l d _ d i r } / $ { t a r g e t } C o n f i g V e r s i o n . c m a k e "
2019-02-11 11:12:07 +00:00
$ { a r g _ A D D I T I O N A L _ F I L E S }
D E S T I N A T I O N " $ { c o n f i g _ i n s t a l l _ d i r } "
C O M P O N E N T D e v e l
)
endfunction ( )
# Call this function in 3rdparty find modules that ought to be installed alongside
# Qt modules and must be found when linking statically.
function ( qt_install_3rdparty_library target )
qt_install_static_target_export ( ${ target } EXPORT ${ target } )
qt_install_3rdparty_config_files ( ${ target } EXPORT ${ target } ${ ARGN } )
endfunction ( )
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
macro ( qt_find_apple_system_frameworks )
if ( APPLE )
find_library ( FWAppKit AppKit )
2019-04-08 15:23:57 +00:00
find_library ( FWAssetsLibrary AssetsLibrary )
find_library ( FWAudioToolbox AudioToolbox )
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
find_library ( FWApplicationServices ApplicationServices )
find_library ( FWCarbon Carbon )
find_library ( FWCoreFoundation CoreFoundation )
find_library ( FWCoreServices CoreServices )
2019-04-08 15:23:57 +00:00
find_library ( FWCoreGraphics CoreGraphics )
find_library ( FWCoreText CoreText )
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
find_library ( FWCoreVideo CoreVideo )
find_library ( FWcups cups )
find_library ( FWDiskArbitration DiskArbitration )
find_library ( FWFoundation Foundation )
2019-10-01 09:01:26 +00:00
find_library ( FWIOBluetooth IOBluetooth )
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
find_library ( FWIOKit IOKit )
find_library ( FWIOSurface IOSurface )
find_library ( FWImageIO ImageIO )
find_library ( FWMetal Metal )
find_library ( FWMobileCoreServices MobileCoreServices )
find_library ( FWQuartzCore QuartzCore )
find_library ( FWSecurity Security )
find_library ( FWSystemConfiguration SystemConfiguration )
find_library ( FWUIKit UIKit )
find_library ( FWWatchKit WatchKit )
2019-10-01 08:36:51 +00:00
find_library ( FWGameController GameController )
Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.
Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.
Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
have a .git subdir and thus defaults to be built in Release
mode, even though qtbase might have been built in Debug, so to
avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
the tests project doesn't specify a major version, and if we
override the values, the moc / uic targets don't get the correct
major version prefix and configuration fails
Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 08:22:08 +00:00
endif ( )
endmacro ( )
2019-05-28 12:13:27 +00:00
# Match the pattern 'regex' in 'input_line', replace the match with 'replacement'
# and set that result in 'out_var' in the parent scope.
function ( qt_regex_match_and_get input_line regex replacement out_var )
string ( REGEX MATCH "${regex}" match "${input_line}" )
if ( match )
string ( REGEX REPLACE "${regex}" "${replacement}" match "${input_line}" )
string ( STRIP ${ match } match )
set ( ${ out_var } "${match}" PARENT_SCOPE )
endif ( )
endfunction ( )
# Match 'regex' in a list of lines. When found, set the value to 'out_var' and break early.
function ( qt_qlalr_find_option_in_list input_list regex out_var )
foreach ( line ${ input_list } )
qt_regex_match_and_get ( "${line}" "${regex}" "\\1" option )
if ( option )
string ( TOLOWER ${ option } option )
set ( ${ out_var } "${option}" PARENT_SCOPE )
return ( )
endif ( )
endforeach ( )
message ( FATAL_ERROR "qt_qlalr_find_option_in_list: Could not extract ${out_var}" )
endfunction ( )
# Generate a few output files using qlalr, and assign those to 'consuming_target'.
# 'input_file_list' is a list of 'foo.g' file paths.
# 'flags' are extra flags to be passed to qlalr.
2019-10-11 11:42:06 +00:00
function ( qt_process_qlalr consuming_target input_file_list flags )
2019-05-28 12:13:27 +00:00
foreach ( input_file ${ input_file_list } )
file ( STRINGS ${ input_file } input_file_lines )
qt_qlalr_find_option_in_list ( "${input_file_lines}" "^%parser(.+)" "parser" )
qt_qlalr_find_option_in_list ( "${input_file_lines}" "^%decl(.+)" "decl" )
qt_qlalr_find_option_in_list ( "${input_file_lines}" "^%impl(.+)" "impl" )
get_filename_component ( base_file_name ${ input_file } NAME_WE )
set ( cpp_file "${parser}.cpp" )
set ( private_file "${parser}_p.h" )
set ( decl_file "${decl}" )
set ( impl_file "${impl}" )
add_custom_command (
O U T P U T $ { c p p _ f i l e } $ { p r i v a t e _ f i l e } $ { d e c l _ f i l e } $ { i m p l _ f i l e }
C O M M A N D $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : q l a l r $ { f l a g s } $ { i n p u t _ f i l e }
2020-01-31 13:44:52 +00:00
D E P E N D S $ { Q T _ C M A K E _ E X P O R T _ N A M E S P A C E } : : q l a l r
2019-05-28 12:13:27 +00:00
M A I N _ D E P E N D E N C Y $ { i n p u t _ f i l e }
)
target_sources ( ${ consuming_target } PRIVATE ${ cpp_file } ${ impl_file } )
endforeach ( )
endfunction ( )
2019-05-31 14:30:09 +00:00
macro ( qt_add_string_to_qconfig_cpp str )
string ( LENGTH "${str}" length )
string ( APPEND QT_CONFIG_STRS " \" ${ str } \\0\"\n")
string ( APPEND QT_CONFIG_STR_OFFSETS " ${QT_CONFIG_STR_OFFSET},\n" )
math ( EXPR QT_CONFIG_STR_OFFSET "${QT_CONFIG_STR_OFFSET}+${length}+1" )
endmacro ( )
function ( qt_generate_qconfig_cpp )
set ( QT_CONFIG_STR_OFFSET "0" )
set ( QT_CONFIG_STR_OFFSETS "" )
set ( QT_CONFIG_STRS "" )
# Start first part.
qt_add_string_to_qconfig_cpp ( "doc" )
qt_add_string_to_qconfig_cpp ( "include" )
qt_add_string_to_qconfig_cpp ( "lib" )
qt_add_string_to_qconfig_cpp ( "libexec" )
qt_add_string_to_qconfig_cpp ( "bin" )
qt_add_string_to_qconfig_cpp ( "plugins" )
qt_add_string_to_qconfig_cpp ( "qml" )
qt_add_string_to_qconfig_cpp ( "." )
qt_add_string_to_qconfig_cpp ( "." )
qt_add_string_to_qconfig_cpp ( "translations" )
qt_add_string_to_qconfig_cpp ( "examples" )
qt_add_string_to_qconfig_cpp ( "tests" )
# Save first part.
set ( QT_CONFIG_STR_OFFSETS_FIRST "${QT_CONFIG_STR_OFFSETS}" )
set ( QT_CONFIG_STRS_FIRST "${QT_CONFIG_STRS}" )
# Start second part.
set ( QT_CONFIG_STR_OFFSETS "" )
set ( QT_CONFIG_STRS "" )
qt_add_string_to_qconfig_cpp ( "" )
qt_add_string_to_qconfig_cpp ( "false" )
qt_add_string_to_qconfig_cpp ( "bin" )
qt_add_string_to_qconfig_cpp ( "lib" )
qt_add_string_to_qconfig_cpp ( "." )
qt_add_string_to_qconfig_cpp ( "${QT_QMAKE_TARGET_MKSPEC}" )
qt_add_string_to_qconfig_cpp ( "${QT_QMAKE_HOST_MKSPEC}" )
# Save second part.
set ( QT_CONFIG_STR_OFFSETS_SECOND "${QT_CONFIG_STR_OFFSETS}" )
set ( QT_CONFIG_STRS_SECOND "${QT_CONFIG_STRS}" )
2019-10-11 14:55:55 +00:00
# Settings path / sysconf dir.
if ( APPLE )
set ( QT_DEFAULT_SYS_CONF_DIR "/Library/Preferences/Qt" )
else ( )
set ( QT_DEFAULT_SYS_CONF_DIR "etc/xdg" )
endif ( )
# Compute and set relocation prefixes.
# TODO: Clean this up, there's a bunch of unrealistic assumptions here.
# See qtConfOutput_preparePaths in qtbase/configure.pri.
if ( WIN32 )
2020-01-21 14:02:58 +00:00
set ( lib_location_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
2019-10-11 14:55:55 +00:00
else ( )
2020-01-21 14:38:27 +00:00
set ( lib_location_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}" )
2019-10-11 14:55:55 +00:00
endif ( )
file ( RELATIVE_PATH from_lib_location_to_prefix
" $ { l i b _ l o c a t i o n _ a b s o l u t e _ p a t h } " " $ { C M A K E _ I N S T A L L _ P R E F I X } " )
if ( QT_HOST_PATH )
set ( host_prefix "${QT_HOST_PATH}" )
2020-01-21 14:02:58 +00:00
set ( host_bin_dir_absolute_path "${QT_HOST_PATH}/${INSTALL_BINDIR}" )
2019-10-11 14:55:55 +00:00
else ( )
set ( host_prefix "${CMAKE_INSTALL_PREFIX}" )
2020-01-21 14:02:58 +00:00
set ( host_bin_dir_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
2019-10-11 14:55:55 +00:00
endif ( )
file ( RELATIVE_PATH from_host_bin_dir_to_host_prefix
" $ { h o s t _ b i n _ d i r _ a b s o l u t e _ p a t h } " " $ { h o s t _ p r e f i x } " )
# TODO: Fix this to use the equivalent of extprefix on CMake (CMAKE_STAGING_PREFIX?)
# For now just assume ext prefix is same as regular prefix.
file ( RELATIVE_PATH from_host_bin_dir_to_ext_prefix
" $ { h o s t _ b i n _ d i r _ a b s o l u t e _ p a t h } " " $ { C M A K E _ I N S T A L L _ P R E F I X } " )
set ( QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "${from_lib_location_to_prefix}" )
set ( QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "${from_host_bin_dir_to_host_prefix}" )
set ( QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "${from_host_bin_dir_to_ext_prefix}" )
2019-05-31 14:30:09 +00:00
configure_file ( global/qconfig.cpp.in global/qconfig.cpp @ONLY )
endfunction ( )
2019-10-17 08:14:09 +00:00
function ( qt_set_language_standards )
## Use the latest standard the compiler supports (same as qt_common.prf)
if ( QT_FEATURE_cxx2a )
set ( CMAKE_CXX_STANDARD 20 PARENT_SCOPE )
2020-02-13 12:39:38 +00:00
else ( )
2019-10-17 08:14:09 +00:00
set ( CMAKE_CXX_STANDARD 17 PARENT_SCOPE )
endif ( )
if ( c_std_11 IN_LIST CMAKE_C_COMPILE_FEATURES )
set ( CMAKE_C_STANDARD 11 PARENT_SCOPE )
elseif ( c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES )
set ( CMAKE_C_STANDARD 99 PARENT_SCOPE )
endif ( )
endfunction ( )
2019-11-13 13:03:20 +00:00
2020-02-17 08:54:59 +00:00
function ( qt_enable_msvc_cplusplus_define target visibility )
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus.
# Check qt_config_compile_test for more info.
if ( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1913 )
target_compile_options ( "${target}" ${ visibility } "-Zc:__cplusplus" )
endif ( )
endfunction ( )
2019-11-13 13:03:20 +00:00
# Compatibility macros that should be removed once all their usages are removed.
function ( extend_target )
qt_extend_target ( ${ ARGV } )
endfunction ( )
function ( add_qt_module )
qt_add_module ( ${ ARGV } )
endfunction ( )
function ( add_qt_plugin )
qt_add_plugin ( ${ ARGV } )
endfunction ( )
function ( add_qt_tool )
qt_add_tool ( ${ ARGV } )
endfunction ( )
function ( add_qt_test )
qt_add_test ( ${ ARGV } )
endfunction ( )
function ( add_qt_test_helper )
qt_add_test_helper ( ${ ARGV } )
endfunction ( )
function ( add_qt_manual_test )
qt_add_manual_test ( ${ ARGV } )
endfunction ( )
function ( add_qt_benchmark )
qt_add_benchmark ( ${ ARGV } )
endfunction ( )
function ( add_qt_executable )
qt_add_executable ( ${ ARGV } )
endfunction ( )
function ( add_qt_simd_part )
qt_add_simd_part ( ${ ARGV } )
endfunction ( )
function ( add_qt_docs )
qt_add_docs ( ${ ARGV } )
endfunction ( )
function ( add_qt_resource )
qt_add_resource ( ${ ARGV } )
endfunction ( )
function ( add_cmake_library )
qt_add_cmake_library ( ${ ARGV } )
endfunction ( )