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

From Qt Wiki
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">&lt;</span>$<span class="sy0">&lt;</span>PLATFORM_ID<span class="sy0">:</span>WIN32<span class="sy0">&gt;:</span>foo_win.<span class="me1">cpp</span><span class="sy0">&gt;</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">&lt;</span>$<span class="sy0">&lt;</span>PLATFORM_ID<span class="sy0">:</span>UNIX<span class="sy0">&gt;:</span>unixlib<span class="sy0">&gt;</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

  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
  2. # Recent features in CMake and Qt 5.1 implement ‘target usage requirements’ http://community.kde.org/Frameworks/Epics/CMake_target_usage_requirements
  3. # https://qt.gitorious.org/qt/qtbase/blobs/dev/tests/auto/cmake/test_interface/CMakeLists.txt
  4. Qt CI tests the CMake files in many scenarios in the build and install locations.
  5. Upcoming features in CMake upstream make using static Qt builds more elegant
  6. # A file needs to be generated whenever QtGui is used which loads the platform plugin (for qmake feature-parity). This will be automatic.
  7. # Support for multiple toolchains and proper sysroot handling will make using Qt in cross-compile scenarios more easy.
  8. CMake toolchain files for all platforms will be generated while building Qt: https://codereview.qt.io/#change,53858
  9. CMake functionality is growing ever-more declarative
  1.      find_package(Qt4)
  2.      find_package(Qt5Core)
  3.    
  4.      qt4_generate_moc(myfile.h moc_myfile.cpp TARGET qt4_foo) # Note, qt5_foo target doesn't
  5.                                                           # exist until below.
  6.    
  7.      qt5_generate_moc(myfile.h moc_myfile.cpp TARGET qt5_foo) # Note, qt5_foo target doesn't
  8.                                                           # exist until below.
  9.    
  10.      add_library(qt4_foo ...)
  11.      add_library(qt5_foo ...)
  1. Use of CMake is growing more declarative. Ie from
  1. set(srcs foo.cpp)
  2. if (WIN32)
  3.   list(APPEND srcs foo_win.cpp)
  4. endif()
  5. add_library(foolib ${srcs})
  6. target_link_libraries(foolib bar)
  7. if (UNIX)
  8.   target_link_libraries(foolib unixlib)  
  9. endif()

to

  1. add_library(foolib
  2.   foo.cpp
  3.   $<$<PLATFORM_ID:WIN32>:foo_win.cpp>
  4. )
  5. target_link_libraries(foolib
  6.   bar
  7.   $<$<PLATFORM_ID:UNIX>:unixlib>
  8. )

in version 2.8.13.

  1. CMake might replace its current language with a more-declarative one (Lua).

Tasks:

  1. Improve Creator CMake support
  2. Complete the cross compiling features upstream
  3. Implement CPack generator for BB10 bar files.
  4. Implement UI in creator to create packages in all formats known to CPack