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

21896 questions
8
votes
2 answers

What is the default build configuration of cmake

In this answer, it says Debug is the default cmake build configuration. But I have a different observation: I have following in my CMakeLists.txt to choose debug and release versions of a lib according to the current build…
Lahiru Chandima
  • 16,832
  • 14
  • 78
  • 137
8
votes
2 answers

OpenGL + Qt using CMake

I have a Qt project created with a *.pro file that I need to migrate it to a CMakeLists. This project uses a simple OpenGL animation to show a 3D model of a hand. I already change it to use CMake, but I encounter 2 problems. (The program compiles…
api55
  • 9,870
  • 4
  • 35
  • 52
8
votes
2 answers

Is there a cmake function to update .pot files?

I am migrating a project from autotools to cmake. I have a question about gettext support. There is an existing FindGettext.cmake modules that provides a nice function : GETTEXT_CREATE_TRANSLATIONS(foo.pot ALL fr.po de.po) where you provide a pot…
phtrivier
  • 12,156
  • 4
  • 42
  • 73
8
votes
3 answers

How do I make build rules in cmake to preprocess lazy C++ .lzz files that generate .h and .cpp files?

What I'd like to do is write just Lazy C++ .lzz files and then have lzz run before a build to generate .cpp and .h files that will be built into the final application, sort of like how moc works with Qt. Is there any way to do this?
jjacksonRIAB
  • 127
  • 1
  • 8
8
votes
2 answers

How to get the list of files that will be installed when installing a CMake component

Is there any way to know programmatically (in CMake) what files will be installed if a COMPONENT is installed (something like a get_property of component)? Currently, I am installing a COMPONENT to a temporary location for packaging (not using CPack…
k0n3ru
  • 593
  • 1
  • 5
  • 24
8
votes
2 answers

Change C++ compiler for cmake under TravisCI

As far I know the best way to change the target C++ compiler used by cmake is to change the CXX environment variable just before the call to cmake: $ export CXX="clang++" && cmake --build The Travis CI build sets the CXX and CC accordingly to the…
Manu343726
  • 13,319
  • 3
  • 35
  • 69
8
votes
3 answers

How to get a relative path to a target with CMake?

I have a project that uses CMake to generate build scripts, and each platform puts the executable that are generated in a different place. We have a non-programmer on our team who does not have build tools and I want to be able to bundle up all the…
Alex
  • 13,729
  • 13
  • 55
  • 88
8
votes
1 answer

cmake link against dll/lib

The output of my cmake is a static library. I'm creating it as such: add_library(myMainLib STATIC ${BACKEND_SOURCES}) Problems arise when I try to get myMainLib to link against a third party lib/dll. The dll file will be found at run time, however,…
h_b
  • 205
  • 1
  • 3
  • 10
8
votes
1 answer

CMake -- Add all sources in subdirectory to cmake project

As a follow up to this question: Add Source in a subdirectory to a cmake project What is the best way (perhaps using the FILE directive?) to select all the .cpp and .h files in the subdirectory and add them to the SOURCE variable defined in the…
therealrootuser
  • 7,249
  • 6
  • 27
  • 43
8
votes
1 answer

cpack generates RPMs with %files entries that conflict with the RPM spec. How to fix?

Recently, I need to ensure that our software can be packaged using cpack for RHEL 7 and its free rebuilds (e.g. CentOS 7). Nevertheless, I have been having an issue that didn't exist for RHEL 6.x and its free rebuilds: the RPMs that cpack generates…
user183394
  • 963
  • 1
  • 8
  • 20
8
votes
1 answer

How to make CMake to set Visual Studio linker's option Generate Debug Info as yes?

I am using CMake to generate Visual Studio project. In my release edition, I also want to set Visual Studio project's one property as Yes, which is properties ==> Configuration Properties ==> Linker ==> Debugging ==> Generate Debug Info. Is it…
cookwhy
  • 726
  • 8
  • 21
8
votes
1 answer

Linking freetype with cmake

I'm having troubles with linking freetype 2 under linux using cmake when building a C++11 project with an extern C library. With cmake and freetype 2 I basically have 2 options : use the utility freetype-config like freetype-config --libs use the…
user2485710
  • 8,623
  • 9
  • 48
  • 92
8
votes
2 answers

CMake disable -std=c++11 flag for C files

I'm trying to build bkchaind. One build option is to use cmake, so I installed it with Homebrew (OSX 10.9.1). When I do cmake, though, I get: [ 2%] Building C object…
Claudiu
  • 206,738
  • 150
  • 445
  • 651
8
votes
2 answers

CMake or gyp for node.js addon development

In most of tutorials, they use gyp as the building system for C++ node.js add-on development. However, compared to gyp, CMake has a long history and have much much more documentations. Therefore, my question is that: which one is better for node.js…
Lin Z
  • 161
  • 2
  • 9
8
votes
1 answer

Where to place libraries for emscripten and CMake

When I want to use a libraries in "normal" programs I install them with apt apt-get install libjsoncpp-dev apt-get install libassimp-dev And then FIND_LIBRARY in CMakeLists.txt FIND_LIBRARY(JSONCPP_LIBRARY NAMES jsoncpp) TARGET_LINK_LIBRARIES(hello…
cnubidu
  • 106
  • 4
1 2 3
99
100