Setting Up a Generic ProjectQt Creator supports generic projects, so you can import existing projects that do not use qmake or CMake and Qt Creator ignores your build system. Generic project support allows you to use Qt Creator as a code editor. You can change the way your project is built by modifying the make command in the Projects mode under Build Settings. When you import a project, Qt Creator creates the following files that allow you to specify which files belong to your project and which include directories or defines you want to pass to your compile: .files, .includes, and .config. Importing a Generic ProjectTo import an existing generic project:
When the project is successfully imported, Qt Creator creates the project tree in the sidebar. After importing a generic project into Qt Creator, open it by selecting the .creator file. Working with Generic Project FilesFor a generic project, you have to manually specify which files belong to your project and which include directories or defines you want to pass to your compiler. Specifying FilesThe list of files for a generic project is specified in the .files file. When you first create a generic project, Qt Creator adds any files it recognizes to your project. To add or remove files, edit the .files file in Qt Creator. Qt Creator recreates your project tree when you save the .files file. Alternatively, you can add and remove files using the context menu in the project tree. If you frequently need to update the .files file, you can do so efficiently by using a script that updates the file for you. If the file is modified externally, you have to restart Qt Creator for the changes to take effect. To update the .files on the Git repository use the following script: git ls-files *.cpp *.h > MyProject.files Specifying Include PathsThe include paths are specified in the .includes file, one include path per line. The paths can be either absolute or relative to the .includes file. Specifying DefinesThe defines are specified in the .config file. The .config file is a regular C++ file, prepended to all your source files when they are parsed. Only use the .config file to add lines as in the example below: #define NAME value Creating a Run ConfigurationQt Creator cannot automatically determine which executable to run. In the Projects mode under Run Settings, define the executable file to run:
© 2008-2010 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy X
|