Autotools
In CLion, you can work with projects that require pre-configuration steps to prepare the actual Makefile. The scripts of GNU Autotools, Kbuild, and PERL MakeMaker are detected automatically and executed to get the Makefile and load the project. CLion also supports the xmkmf tool, which generates Makefiles from the Imakefile template.
Autotools project
When you open a project folder, CLion recognizes it as an Autotools project in the following cases:
If there is a configure.ac or a configure.in file under the project root, but not both.
If there is a Makefile.in, Makefile.am, or both.
The presence of an already generated Makefile or a configure script does not affect this.
Pre-configuration (GNU Autoconf)
If GNU Autoconf is installed on your system (autoreconf should be in the system PATH
), CLion will call it first.
![Pre-configuring the project with autoreconf Pre-configuring the project with autoreconf](https://resources.jetbrains.com/help/img/idea/2024.2/cl_makefile_autoreconf.png)
By default, CLion uses the following commands to configure an Autotools project:
You can change this set of commands as needed (see below).
Control preconfigure parameters
If required, you can adjust the pre-configuration commands.
Go to
.Make necessary changes in the Commands field:
For example, to run an additional pre-configuration script like
bootstrap
, add the following command:./bootstrap <args>Also notice the very first line in the default set of commands,
#!/bin/sh
. It explicitly specifies the POSIX default interpreter /bin/sh. You can leave this command as is or change it to use another interpreter, for example#!/usr/bin/python
for Python.You can also change the build directory either in the Build directory field or via the
-C path
flag in Build options.Note the following when changing the build directory:
The previous directory will not be removed.
If the new build directory doesn't exist, CLion will create it before the pre-configure step if the script is not empty. Otherwise, the directory will not be created.
Change the toolchain
When executing Autotools scripts, CLion fetches the compilers from the toolchain specified in
.If you open the project for the first time, CLion will use the default toolchain.
Note that you can specify a remote toolchain here as well.
PERL MakeMaker projects
MakeMaker-generated Makefiles don't have separate targets for clean
and distclean
. There is only the clean
target, which cleans up the project tree and also deletes the Makefile itself.
So for MakeMaker projects, the make clean
command should only be run as a part of the pre-configuration step. CLion uses the following pre-configuration script, which you can always adjust if required:
Remote mode limitations
In remote mode, the build directory is not synchronized to the local machine. Make sure to sync config.h manually.
Windows-specific issues on remote: