KDevelop4/Manual/Getting started: A small CMake tutorial: Difference between revisions

From KDE Wiki Sandbox
(Created page with "{{Construction}} In this chapter, you will learn how to build your CMake based project and how to add files. If you want do get a more in-depth tutorial on CMake, see [[KDevelo...")
 
No edit summary
Line 4: Line 4:


If you want do get a more in-depth tutorial on CMake, see [[KDevelop4/Manual/Appendix B: CMake for bigger projects|Appendix B: CMake for bigger projects]].
If you want do get a more in-depth tutorial on CMake, see [[KDevelop4/Manual/Appendix B: CMake for bigger projects|Appendix B: CMake for bigger projects]].
== Adding a file ==
[[image:kdevelop4_target_addfile.png|thumb]]
Right-click on the project's main target and select <menuchoice>Create File</menuchoice>. You will be asked for a filename &ndash; enter <code>helloworld.cpp</code> here and click on "OK".
The dialog that pops up now shows the changes that will be made to <code>CMakeLists.txt</code>. For now, click on "OK".
The newly created file is now opened in the editor. Enter the following code and save the file:
{{Input|void heyWorld() {
    std::cout << "Hello, world!";
} }}


{{KDevelop4Nav|prev=Getting started|next=Getting started: Sessions and Projects}}
{{KDevelop4Nav|prev=Getting started|next=Getting started: Sessions and Projects}}

Revision as of 07:41, 8 December 2010

Under Construction
This is a new page, currently under construction!


In this chapter, you will learn how to build your CMake based project and how to add files.

If you want do get a more in-depth tutorial on CMake, see Appendix B: CMake for bigger projects.

Adding a file

Right-click on the project's main target and select Create File. You will be asked for a filename – enter helloworld.cpp here and click on "OK".

The dialog that pops up now shows the changes that will be made to CMakeLists.txt. For now, click on "OK".

The newly created file is now opened in the editor. Enter the following code and save the file:

void heyWorld() {
    std::cout << "Hello, world!";
}