Dienstag, 31. Januar 2017

Configure NetBeans to develop C++14 applications with CMake and CLang

This blog post will show how to configure the NetBeans IDE to develop a C++ application with CMake and CLang.

The structure of the project looks like this:
<project dir>
  |- debug
  |- release
  |- src (contains CMakeLists.txt)

First you need to set the language version in Tools -> Options -> C/C++:

Then you have to create a new project: File -> New Project... -> C/C++ Project with Existing Sources. Then select CLang in Tool Collection in the Select Mode step. Select Custom for Select Configuration Mode so that you can specify the build directory:

In the step Pre-Build Action select the debug folder for Run in Folder:

 Skip to the step Project Name and Location. Set the project name and select the root folder of your project dir as Project Location:

The Project Name should be the same as project dir.

Configure a debug and release configuration in the next step. Open the project properties: File -> Propject Properties -> Build and select Manage Configurations.... Rename the current configuration to Debug and select Duplicate. Rename the duplicated configuration to Release and select the release directory as Working Directory. Also change Pre-Build -> Command Line from

Now you can change between release and debug builds. Don't forget to execute the pre-build step before building the project for the first time.

Keine Kommentare:

Kommentar veröffentlichen