Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Qt-contributors-summit-2013-CMake-files-feedback-requests: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
# CMake files can be used elegantly for all platforms and most Qt configurations (shared/static/mac-framework/cross-compiles), especially with CMake 2.8.11 | |||
# # Recent features in CMake and Qt 5.1 implement ‘target usage requirements’ http://community.kde.org/Frameworks/Epics/CMake_target_usage_requirements | |||
# # https://qt.gitorious.org/qt/qtbase/blobs/dev/tests/auto/cmake/test_interface/CMakeLists.txt | |||
# Qt CI tests the CMake files in many scenarios in the build and install locations. | |||
# Upcoming features in CMake upstream make using static Qt builds more elegant | |||
# # A file needs to be generated whenever QtGui is used which loads the platform plugin (for qmake feature-parity). This will be automatic. | |||
# # Support for multiple toolchains and proper sysroot handling will make using Qt in cross-compile scenarios more easy. | |||
# CMake toolchain files for all platforms will be generated while building Qt: https://codereview.qt.io/#change,53858 | |||
# CMake functionality is growing ever-more declarative | |||
<div class="cpp-qt geshi"> | |||
# <div class="de1"> find_package<span class="br0">(</span>Qt4<span class="br0">)</span></div> | |||
# <div class="de1"> find_package<span class="br0">(</span>Qt5Core<span class="br0">)</span></div> | |||
# <div class="de1"> </div> | |||
# <div class="de1"> qt4_generate_moc<span class="br0">(</span>myfile.<span class="me1">h</span> moc_myfile.<span class="me1">cpp</span> TARGET qt4_foo<span class="br0">)</span> <span class="co2"># Note, qt5_foo target doesn't</span></div> | |||
# <div class="de2"> <span class="co2"># exist until below.</span></div> | |||
# <div class="de1"> </div> | |||
# <div class="de1"> qt5_generate_moc<span class="br0">(</span>myfile.<span class="me1">h</span> moc_myfile.<span class="me1">cpp</span> TARGET qt5_foo<span class="br0">)</span> <span class="co2"># Note, qt5_foo target doesn't</span></div> | |||
# <div class="de1"> <span class="co2"># exist until below.</span></div> | |||
# <div class="de1"> </div> | |||
# <div class="de2"> add_library<span class="br0">(</span>qt4_foo ...<span class="br0">)</span></div> | |||
# <div class="de1"> add_library<span class="br0">(</span>qt5_foo ...<span class="br0">)</span></div> | |||
</div> | |||
# Use of CMake is growing more declarative. Ie from | |||
<div class="cpp-qt geshi"> | |||
# <div class="de1">set<span class="br0">(</span>srcs foo.<span class="me1">cpp</span><span class="br0">)</span></div> | |||
# <div class="de1"><span class="kw1">if</span> <span class="br0">(</span>WIN32<span class="br0">)</span></div> | |||
# <div class="de1"> list<span class="br0">(</span>APPEND srcs foo_win.<span class="me1">cpp</span><span class="br0">)</span></div> | |||
# <div class="de1">endif<span class="br0">(</span><span class="br0">)</span></div> | |||
# <div class="de2">add_library<span class="br0">(</span>foolib $<span class="br0">{</span>srcs<span class="br0">}</span><span class="br0">)</span></div> | |||
# <div class="de1">target_link_libraries<span class="br0">(</span>foolib bar<span class="br0">)</span></div> | |||
# <div class="de1"><span class="kw1">if</span> <span class="br0">(</span>UNIX<span class="br0">)</span></div> | |||
# <div class="de1"> target_link_libraries<span class="br0">(</span>foolib unixlib<span class="br0">)</span> </div> | |||
# <div class="de1">endif<span class="br0">(</span><span class="br0">)</span></div> | |||
</div> | |||
to | |||
<div class="cpp-qt geshi"> | |||
# <div class="de1">add_library<span class="br0">(</span>foolib </div> | |||
# <div class="de1"> foo.<span class="me1">cpp</span></div> | |||
# <div class="de1"> $<span class="sy0"><</span>$<span class="sy0"><</span>PLATFORM_ID<span class="sy0">:</span>WIN32<span class="sy0">>:</span>foo_win.<span class="me1">cpp</span><span class="sy0">></span></div> | |||
# <div class="de1"><span class="br0">)</span></div> | |||
# <div class="de2">target_link_libraries<span class="br0">(</span>foolib </div> | |||
# <div class="de1"> bar</div> | |||
# <div class="de1"> $<span class="sy0"><</span>$<span class="sy0"><</span>PLATFORM_ID<span class="sy0">:</span>UNIX<span class="sy0">>:</span>unixlib<span class="sy0">></span></div> | |||
# <div class="de1"><span class="br0">)</span></div> | |||
</div> | |||
in version 2.8.13. | |||
# CMake might replace its current language with a more-declarative one (Lua). | |||
Tasks: | |||
# Improve Creator CMake support | |||
# Complete the cross compiling features upstream | |||
# Implement CPack generator for BB10 bar files. | |||
# Implement UI in creator to create packages in all formats known to CPack |
Revision as of 14:05, 25 February 2015
- CMake files can be used elegantly for all platforms and most Qt configurations (shared/static/mac-framework/cross-compiles), especially with CMake 2.8.11
- # Recent features in CMake and Qt 5.1 implement ‘target usage requirements’ http://community.kde.org/Frameworks/Epics/CMake_target_usage_requirements
- # https://qt.gitorious.org/qt/qtbase/blobs/dev/tests/auto/cmake/test_interface/CMakeLists.txt
- Qt CI tests the CMake files in many scenarios in the build and install locations.
- Upcoming features in CMake upstream make using static Qt builds more elegant
- # A file needs to be generated whenever QtGui is used which loads the platform plugin (for qmake feature-parity). This will be automatic.
- # Support for multiple toolchains and proper sysroot handling will make using Qt in cross-compile scenarios more easy.
- CMake toolchain files for all platforms will be generated while building Qt: https://codereview.qt.io/#change,53858
- CMake functionality is growing ever-more declarative
- find_package(Qt4)
- find_package(Qt5Core)
- qt4_generate_moc(myfile.h moc_myfile.cpp TARGET qt4_foo) # Note, qt5_foo target doesn't
- # exist until below.
- qt5_generate_moc(myfile.h moc_myfile.cpp TARGET qt5_foo) # Note, qt5_foo target doesn't
- # exist until below.
- add_library(qt4_foo ...)
- add_library(qt5_foo ...)
- Use of CMake is growing more declarative. Ie from
- set(srcs foo.cpp)
- if (WIN32)
- list(APPEND srcs foo_win.cpp)
- endif()
- add_library(foolib ${srcs})
- target_link_libraries(foolib bar)
- if (UNIX)
- target_link_libraries(foolib unixlib)
- endif()
to
- add_library(foolib
- foo.cpp
- $<$<PLATFORM_ID:WIN32>:foo_win.cpp>
- )
- target_link_libraries(foolib
- bar
- $<$<PLATFORM_ID:UNIX>:unixlib>
- )
in version 2.8.13.
- CMake might replace its current language with a more-declarative one (Lua).
Tasks:
- Improve Creator CMake support
- Complete the cross compiling features upstream
- Implement CPack generator for BB10 bar files.
- Implement UI in creator to create packages in all formats known to CPack