Questions tagged [cmake]

CMake is a cross-platform, open-source build system generator. It generates files for build systems like native makefiles, ninja-build and project files for several integrated development environments.

CMake is a cross-platform, open-source build system generator. It generates files for build systems like native makefiles, ninja-build and project files for several integrated development environments.

It is often used along with , and .

Official

Quick Start / Howtos

Wisdom of the Stack

Books

27471 questions
10
votes
2 answers

CMake Gcov c++ creating wrong .gcno files

I have a CMakeLists.txt file in which I added: set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -pthread -std=c++11 -O0 ${CMAKE_CXX_FLAGS}") It is generating the report files in: project_root/build/CMakeFiles/project.dir/ BUT the files it…
fedest
  • 1,190
  • 3
  • 15
  • 35
10
votes
2 answers

Why does CMake ignore exported CXX and CC environment variables?

I am running a CMake (3.4.3) like this as explained in the CMake FAQ's: export CC="cc_args.py $PWD/../bin/gcc" export CXX="cc_args.py $PWD/../bin/g++" cmake -DCMAKE_BUILD_TYPE=Debug .. However when I print CMAKE_CXX_COMPILER and CMAKE_C_COMPILER it…
Lenar Hoyt
  • 5,971
  • 6
  • 49
  • 59
10
votes
1 answer

How to force cmake to link against homebrew keg-only libraries

I have third party cmake project that depends on gnu readline library. So I installed readline by brew install readline. The problem is, readline is a keg-only formula and cmake tries to link it against libedit which shadows libreadline but it lacks…
Pouya
  • 1,266
  • 3
  • 18
  • 44
10
votes
3 answers

Set Opencv path for a c++ project using Cmake

I have two Opencvs, opencv-2.4.10 is installed in /usr and opencv-3.1 is installed in /usr/local. I can set the opencv path in Eclipse easily. In cmake, how can I set the path for one of the opencvs I like to use for that project? Thanks
batuman
  • 7,066
  • 26
  • 107
  • 229
10
votes
1 answer

Could NOT find OpenCL (missing: OpenCL_LIBRARY)

I'm trying to use OpenCL with CLion (specifically boost compute), using CMake, on windows 10 with nvidia gpu. It feels like I have tried everything, but I have no idea how CMake works, and I cannot find a basic enough post on the web for me to…
Filip Haglund
  • 13,919
  • 13
  • 64
  • 113
10
votes
1 answer

Move from Gradle to CMake for C++ project

We have been using Gradle for our C++ project(s) for the last year now but as the complexity of the project grows and our use/creation of libraries increases I find myself dealing with situations where my knowledge of Gradle falls short. The net is…
Jad
  • 413
  • 1
  • 5
  • 11
10
votes
2 answers

Documenting CMakeLists.txt and custom or local .cmake files

What are good ways to document my project CMakeLists.txt files and local project .cmake files? There is a two year old question/answer Documenting CMake scripts that I am essentially asking here again. The answer contains the statement Currently,…
Phil
  • 5,822
  • 2
  • 31
  • 60
10
votes
2 answers

How to check if a CMake build directory build type is Debug or Release?

I know the build type can be set using -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=Debug but is there a command line way to check/confirm which build type is being used by CMake?
jterm
  • 973
  • 1
  • 12
  • 32
10
votes
1 answer

Cmake: Exporting subproject targets to main project

I currently have a project called LIBS with a structure like this: ├── Lib1 │ ├── CMakeLists.txt │ ├── lib1-class.cpp │ └── lib1-class.h ├── lib2 │ └── CMakeLists.txt │ ├── lib2-class.cpp │ ├── lib2-class.h ├── cmake │ └──…
Maths noob
  • 1,684
  • 20
  • 42
10
votes
1 answer

CMAKE: How to install the dependencies of a target

I am trying to install an executable using cmake. My real problem here is: how to install the executable and its dependencies. Here an example: I want to install one executable that depend on two libraries of my cmake and one 3rdparty…
Hevy
  • 101
  • 1
  • 7
10
votes
2 answers

How to control build mode(debug or release) in cmake?

Anyone knows? Seems by default all libraries/executables are built in debug mode.
user198729
  • 61,774
  • 108
  • 250
  • 348
10
votes
2 answers

Building GLFW3 Application with CMAKE - GLFW_LIBRARIES doesnt set

I'm attempting to build a small project using glfw3 but no matter what I do I can't get pkgconfig to set GLFW_LIBRARIES. Here is my CMakeList.txt cmake_minimum_required(VERSION 3.3) project(LearnGLSL) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}…
Thomas
  • 201
  • 1
  • 3
  • 12
10
votes
1 answer

For Cmake, can you modify the release/debug compiler flags with `add_compiler_flags()` command?

In the man page for add_compile_options() I don't see any mention of how to modify the Release/Debug compiler flags. Can you use add_compiler_options() to modify the Release/Debug compiler flags? If yes, how? If no, is the recommended canonical…
Trevor Boyd Smith
  • 18,164
  • 32
  • 127
  • 177
10
votes
1 answer

CMake Passing Lists on Command Line

I need to run swig as part of my cmake build system. I want the user to be able to specify a list of languages to pass to swig and specify them on the command line. $ cmake -DSWIG_LANGUAGES=java,scala Is there a…
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
10
votes
5 answers

OpenCV 3.0.0 "configure" fails, ffmpeg not downloaded

I get the following error when trying to configure OpenCV using CMAKE on windows: CMake Warning at cmake/OpenCVUtils.cmake:865 (message): Download: Local copy of opencv_ffmpeg.dll has invalid MD5 hash: d41d8cd98f00b204e9800998ecf8427e…
S.H
  • 875
  • 2
  • 11
  • 27
1 2 3
99
100