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
11
votes
2 answers

How to get debug postfix in executable name

I am using cmake 2.8.12.2. I have set CMAKE_DEBUG_POSTFIX, and it is automatically used with the add_library command. But it is not automatically used with add_executable command. I have discovered that I can set the DEBUG_POSTFIX target property to…
Phil
  • 5,822
  • 2
  • 31
  • 60
11
votes
3 answers

CMake module for gettext support?

Is there a good, open-source, documented CMake module for gettext support? I mean: Extracting messages from sources Merging messages to existing translations Compilation of mo-files Installation of mo-files. Because plain macros that CMake…
Artyom
  • 31,019
  • 21
  • 127
  • 215
11
votes
3 answers

Is it possible to develop linux kernel module in CLion?

I want to develop some small linux kernel modules in CLion. For example, I want to compile these files: stack.h: #ifndef _LL_STACK_H #define _LL_STACK_H #include typedef struct stack_entry { struct list_head lh; void *data; }…
Denis
  • 3,595
  • 12
  • 52
  • 86
11
votes
2 answers

How to instruct cmake/automoc to find external header

I have a Qt widget C++ class that loads a ui file created in Qt Creator. The header and the source file for the class live in two separate directories. I have trouble instructing cmake/automoc to find the header for the class. cmake recognizes it…
user2180977
  • 401
  • 3
  • 14
11
votes
5 answers

CMake could not find the VTKConfig.cmake

I'm trying to compile a program in CMake but I'm getting this error. By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "VTK", but CMake did not find one. Could not…
MicrobicTiger
  • 577
  • 2
  • 5
  • 21
11
votes
3 answers

CMake: execute a macro/function as the command of add_custom_command

I'm using an external library which provides a CMake function for automatic code generation, to be used in my CMakeLists. The problem is that whenever I modify a CMakeLists then the function is run again, triggering the recompilation of the newly…
Nicola Mori
  • 777
  • 1
  • 5
  • 19
11
votes
5 answers

Creating Windows Desktop Icon in CMake + CPack + NSIS

I'm using NSIS package generator in CMake 2.8.1 to distribute a Qt application. Everything is working fine... except the use of CPACK_CREATE_DESKTOP_LINKS to create a desktop link to the application. I've looked through the CMake source (including…
metasim
  • 4,793
  • 3
  • 46
  • 70
11
votes
2 answers

Escape "[]" characters in a semicolon-separated list in CMake

I found "[" and "]" might have special meanings in a semicolon-separated list in CMake. When I try this code in CMakeLists.txt: set(XX "a" "b" "[" "]") message("${XX}") foreach(x ${XX}) message("--> ${x}") endforeach() I expect the…
Cheng Li
  • 111
  • 4
11
votes
1 answer

C compiler identification is unknown despite setting CC and CXX variables

I'm using the command: cmake CC="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe" CXX="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe" -G "Visual Studio 12 Win64" -DBOOST_ROOT="c:\local\boost_1_56_0"…
batman
  • 5,022
  • 11
  • 52
  • 82
11
votes
1 answer

How to add source files in another folder

I'm using cmake to build my project in C++. Assume I have the following directories on my Source folder Source |_Dir1 | |_Class.cpp | |_Class.hpp | |_Dir2 |_Main.cpp In Dir1 there's a class with its header and implementation…
Setzer22
  • 1,589
  • 2
  • 13
  • 29
11
votes
1 answer

Add dependency to the CMake-generated build-system itself

In short: I know how to add dependencies to targets, in a CMake-generated build system. But I would like to add dependencies to the generated build-system itself. Longer question: In the CMake-generated build process of cgal, we would like CMake to…
lrineau
  • 6,036
  • 3
  • 34
  • 47
11
votes
4 answers

Warning "forced in submake" in parallel execution of make

When I run make -j3 to build in parallel, I get warning: -jN forced in submake: disabling jobserver mode. In the documentation I found the warning is emitted if make detects error conditions related to parallel processing on systems where…
usr1234567
  • 21,601
  • 16
  • 108
  • 128
11
votes
1 answer

CTest - Using Labels for different tests CTestTestfile.cmake

I cannot find how to specify labels. It should be something like ADD_TEST( FirstTest RunSomeProgram "withArguments" ) SET_TESTS_PROPERTIES( FirstTest PROPERTIES LABEL "TESTLABEL" ) Can someone tell me how I can set one of these labels, that I can…
user3791162
  • 111
  • 1
  • 3
11
votes
2 answers

cmake: set icon for a Mac OS X app

Installing a Mac OS X app using cmake environment, I want to set and install the icon in the process of installation. Therefore, I try to set set( MACOSX_BUNDLE_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/myAopImage.icns ) ADD_EXECUTABLE(MYAPP…
user3478292
  • 113
  • 1
  • 5
11
votes
1 answer

Conditionally include a source file

In the root CMakeLists.txt I have add_definition(-DMY_MACRO) Then in a sub CMakeLists.txt I want to do something like add_library(mylib, STATIC file1 #ifdef MY_MACRO file2 #endif ) I tried something like IF( DEFINED MY_MACRO ) SET(FILE2…
James
  • 9,064
  • 3
  • 31
  • 49