OutOfBound
OutOfBound

Reputation: 2004

Add CMAKE variables to project in KDevelop

How can i add CMake variables (e.g. CMAKE_PREFIX_PATH, CMAKE_CXX_COMPILER) to a project in KDevelop5?

Setting the environment variables in Configuration->Environment tab and Project->Configuration->Environment can only set the environment variables but not the cmake variables.

Thank you for your replies.

Upvotes: 2

Views: 1909

Answers (1)

Guillaume Racicot
Guillaume Racicot

Reputation: 41760

When you go to Project -> Open Configuration, you'll see a frame named "Configure CMake settings" In that window, you will see a dropdown that contains the path of your build directory.

Just at the right of that dropdown, you'll see a + button. Click on it. You will see that you can specify Extra Arguments. In this field you can add command line argument to be run with cmake.

In your case, it will be something like this:

-DCMAKE_PREFIX_PATH=<your path> -DCMAKE_CXX_COMPILER=<your compiler>

In addition, if you want to quickly change a variable in a temporary manner, you click on the button "show advanced" and check the case labeled "Show Advanced Value". Then, in the table, you'll see all cmake variables displayed. You can edit them. Be careful with that because kdevelop tends to be instable when you manually change cmake variables without reloading the project.

Note that if you want to keep the same directory as before, you can remove your build directory and then re-add it with the arguments.

I don't know other way to change the extra argument field for the moment.

Upvotes: 1

Related Questions