cmake : Set environment variables from a script

Reading through the cmake quick start, you can specify variable on a command line: cmake -DVARIABLE1=value1 -DVARIABLE2=value2 … Otherwise, set command in the cmake script is probably what you want, see the reference manual. To set the environment variable PATH, do: set(ENV{PATH} “/home/martink”) To set normal variable, do: set(variable “value”) Not sure which ones you …

Read more

How do I convert an Autotools project to a CMake project? [closed]

There is no automated tool that will convert an arbitrary build system from autotools to cmake. I have converted a few moderately large projects manually. I like to create one CMakeLists.txt file for each set of configure.ac and/or Makefile.am file, to ease the conversion from autotools to cmake. Sadly, this manual approach requires developing an …

Read more

CMAKE_BUILD_TYPE is not being used in CMakeLists.txt

There are two types of generators: single-configurations and multi-configurations. Single configurations Make-like generators: Unix Makefiles, NMake Makefiles, MinGW Makefiles, … You set the configuration type in the generate step: cmake -H. -B_builds/Debug -DCMAKE_BUILD_TYPE=Debug “-GUnix Makefiles” In this case, the build step is always Debug: > cmake –build _builds/Debug /usr/bin/c++ -g … > cmake –build _builds/Debug …

Read more

When to use gradle.properties vs. settings.gradle?

settings.gradle The settings.gradle file is a Groovy script, just like the build.gradle file. Only one settings.gradle script will be executed in each build (in comparison to multiple build.gradle scripts in multi-project builds). The settings.gradle script will be executed before any build.gradle script and even before the Project instances are created. Therefore, it is evaluated against …

Read more

What are the differences between Autotools, Cmake and Scons?

In truth, Autotools’ only real ‘saving grace’ is that it is what all the GNU projects are largely using. Issues with Autotools: Truly ARCANE m4 macro syntax combined with verbose, twisted shell scripting for tests for “compatibility”, etc. If you’re not paying attention, you will mess up cross-compilation ability (It should clearly be noted that …

Read more