29,345 questions
660
votes
28
answers
899k
views
Looking for a 'cmake clean' command to clear up CMake output
Just as make clean deletes all the files that a makefile has produced, I would like to do the same with CMake. All too often I find myself manually going through directories removing files like ...
605
votes
6
answers
861k
views
Debug vs Release in CMake [closed]
In a GCC compiled project,
How do I run CMake for each build configuration type (debug/release)?
How do I specify debug and release C/C++ flags using CMake?
How do I express that the main executable ...
556
votes
3
answers
322k
views
What is the difference between using a Makefile and CMake to compile the code?
I code in C/C++ and use a (GNU) Makefile to compile the code. I can do the same with CMake and get a Makefile. However, what is the difference between using a Makefile and CMake to compile the code?
477
votes
10
answers
298k
views
What is CMake equivalent of 'configure --prefix=DIR && make all install '?
I do cmake . && make all install. This works, but installs to /usr/local.
I need to install to a different prefix (for example, to /usr).
What is the cmake and make command line to install ...
450
votes
6
answers
477k
views
Define a preprocessor macro through CMake
How do I define a preprocessor variable through CMake?
The equivalent code would be #define foo.
446
votes
12
answers
1.1m
views
How to properly add include directories with CMake
About a year ago I asked about header dependencies in CMake.
I realized recently that the issue seemed to be that CMake considered those header files to be external to the project. At least, when ...
433
votes
17
answers
601k
views
How do I activate C++ 11 in CMake?
When I try to run a CMake generated makefile to compile my program, I get the error that
range based for loops are not supported in C++ 98 mode.
I tried adding add_definitions(-std=c++0x) to my ...
378
votes
8
answers
276k
views
Using CMake with GNU Make: How can I see the exact commands?
I use CMake with GNU Make and would like to see all commands exactly (for example how the compiler is executed, all the flags etc.).
GNU make has --debug, but it does not seem to be that helpful are ...
353
votes
12
answers
423k
views
Switching between GCC and Clang/LLVM using CMake
I have a number of projects built using CMake and I'd like to be able to easily switch between using GCC or Clang/LLVM to compile them. I believe (please correct me if I'm mistaken!) that to use Clang ...
328
votes
8
answers
250k
views
CMake: Print out all accessible variables in a script
I'm wondering if there is a way to print out all accessible variables in CMake. I'm not interested in the CMake variables - as in the --help-variables option. I'm talking about my variables that I ...
315
votes
8
answers
864k
views
How do I add a linker or compile flag in a CMake file?
I am using the arm-linux-androideabi-g++ compiler. When I try to compile a simple "Hello, World!" program it compiles fine. When I test it by adding a simple exception handling in that code it works ...
303
votes
3
answers
365k
views
What's the CMake syntax to set and use variables?
I'm asking this as a reminder to myself the next time I use CMake. It never sticks, and Google results aren't great.
What's the syntax to set and use variables in CMake?
298
votes
7
answers
124k
views
What are the differences between Autotools, Cmake and Scons?
What are the differences between Autotools, Cmake and Scons?
287
votes
10
answers
362k
views
How do I make CMake output into a 'bin' dir?
I'm currently constructing a project with a plugin structure. I'm using CMake to compile the project. The plugins are compiled in separate directories. My problem is that CMake compiles and saves the ...
273
votes
20
answers
520k
views
CMake not able to find OpenSSL library
I am trying to install a software that uses cmake to install itself. When I run cmake .. on the command line, it gives me following error in the CMakeLists.txt on the line that says find_package(...