Skip to content

Instantly share code, notes, and snippets.

@cristianadam
Last active April 5, 2022 10:21
Show Gist options
  • Save cristianadam/6f72a37c9af135fdce714719ad42f0a5 to your computer and use it in GitHub Desktop.
Save cristianadam/6f72a37c9af135fdce714719ad42f0a5 to your computer and use it in GitHub Desktop.
Qt Creator CMake configuration for a small build
if (CMAKE_ARGC LESS 4)
message("Usage cmake -P " ${CMAKE_ARGV2} " <platform e.g. mingw/msvc>")
return()
endif()
if (CMAKE_ARGV3 STREQUAL "mingw")
set(QT_PLATFORM mingw_64)
elseif(CMAKE_ARGV3 STREQUAL "msvc")
set(QT_PLATFORM msvc2019_64)
endif()
execute_process(COMMAND
${CMAKE_COMMAND} -E time
${CMAKE_COMMAND}
-D "CMAKE_PREFIX_PATH=c:/Qt/6.2.4/${QT_PLATFORM};c:/llvm/${CMAKE_ARGV3}"
-D "CMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_LIST_DIR}/install-${CMAKE_ARGV3}"
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D BUILD_QBS=OFF
-D "BUILD_PLUGINS=Core;Designer;DiffEditor;TextEditor;ProjectExplorer;CppTools;CppEditor;CodePaster;Git;Help;QmakeProjectManager;CMakeProjectManager;ClangCodeModel;ClangTools;Debugger;QtSupport;ResourceEditor;VcsBase;Welcome;LanguageClient"
-D "BUILD_EXECUTABLES=QtCreator;ClangBackend;qtcreator_ctrlc_stub;qtcreator_process_stub;win64interrupt;qtcreator_processlauncher"
-S repo
-B build-${CMAKE_ARGV3}
)
@aportale
Copy link

Since a friend of mine wasn't sure how to use it:
Execute ...

cmake -P configure-small.cmake msvc

... and import in Qt Creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment