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
1 answer

CMake finds more than one main function

I am trying to compile a project that has only one main function, but CMake find more. My CMakeLists.txt is like: cmake_minimum_required(VERSION…
thedarkside ofthemoon
  • 2,251
  • 6
  • 31
  • 48
11
votes
2 answers

How do I see the commands issued by cmake with --build option

How could I see the commands issued when I run "cmake --build . --target INSTALL" command? There doesn't seem to be an option like --versbose or something. The cmake help says that "cmake --build" is an interface to the underlying build tool, but…
bbv
  • 501
  • 1
  • 5
  • 14
11
votes
1 answer

CMake linking against shared library on windows: error about not finding .lib file

I've got a library definition in CMake that builds a shared library out of a small set of files, and I've got it compiling just fine on both linux and windows. However, I've also got another library that links against the shared library and it works…
gct
  • 14,100
  • 15
  • 68
  • 107
11
votes
1 answer

How do I use OpenCV's test framework with CMake?

It seems like OpenCV has a test framework based on GTest. They use it for their own unit tests, but I can not find documentation, examples or tutorials on how to use it outside of OpenCV. It would be a perfect fit for the tests I intend to implement…
user981733
  • 430
  • 4
  • 9
11
votes
2 answers

Building for MacOSX, but linking against dylib built for iOS Simulator file

I've just upgraded to Xcode 5 beta with the April 15 2013 commandline tools and hit the following warning when running a cmake build during the standard CMakeTestCCompiler.cmake attempt to compile a simple test program: cmake -version cmake version…
user1031420
  • 505
  • 1
  • 5
  • 13
11
votes
2 answers

How to specify libraries only for Android platform build in .pro file?

I'm trying to use QtCreator (2.7.2) + QT (5.1.0) to build an application that runs on both desktop (Linux) and mobile (Android) platforms. To achieve this, I need to use different pre-built libraries depending on the target platform. How do I…
Chaos_99
  • 2,284
  • 2
  • 25
  • 29
11
votes
3 answers

Multiple source directories for one executable with CMake

I want my source organised in a number of subdirectories but be able to create a single executable without having to build a library for each subdirectory. Can CMake do this? Something like: ADD_EXECUTABLE(foo a/main.cpp a/other.cpp…
realh
  • 962
  • 2
  • 7
  • 22
11
votes
3 answers

Cannot specify BOOST_ROOT for cmake

I have multiple versions of Boost installed (Windows 7/MinGW). I need to use a particular one (1.53.0). I defined BOOST_ROOT in the CMakeFiles.txt file: SET(BOOST_ROOT C:/boost_1_53_0/), but I keep getting this error: > cmake…
Pietro
  • 12,086
  • 26
  • 100
  • 193
11
votes
1 answer

How to check Windows version in CMake?

How do I check with CMake whether I'm configuring a Visual Studio solution for e.g. Windows 7 or Windows 8? Is there any way to do this?
Marco A.
  • 43,032
  • 26
  • 132
  • 246
11
votes
3 answers

Execute command or macro in CMake as the last step before the 'configure' step finishes

Is it somehow possible with CMake (version >= 2.8.7) to execute a macro or command as a last step before the configuration phase finishes? The functionality should be executed before the following lines get printed on screen: -- Configuring done --…
MKroehnert
  • 3,637
  • 2
  • 34
  • 43
11
votes
1 answer

cmake -D :=: what can be?

-D :=: Create a cmake cache entry. ok, but what can be? I've seen BOOL, STRING, PATH, FILEPATH. What else can that type be?
quimnuss
  • 1,503
  • 2
  • 17
  • 37
11
votes
2 answers

cpack cannot find libraries, target doesn't exist in this directory

EDIT =================== The apr-1 is the apache portable runtime, which I downloaded and compiled myself to create the shared library (so its not made by cmake). I need to link against this library after I run CPack on the target system. My…
ant2009
  • 27,094
  • 154
  • 411
  • 609
11
votes
4 answers

How to Use CMake for Non-Interactive Build on Windows?

I want to set up automated build using CMake on Windows. I am using Visual Studio 2005. Update: Here is what I am using: I set devenv.exe to my PATH. Then to build I run the command below. I am using Hudson to build. devenv Crackpot.sln /build Debug…
amit kumar
  • 20,438
  • 23
  • 90
  • 126
11
votes
4 answers

CUDA 5.0 separate compilation of library with cmake

The buildtime of my cuda library is increasing and so I thought that separate compilation introduced in CUDA 5.0 might help me. I couldn't figure out how to achieve separate compilation with cmake. I looked into the NVCC documentation and found how…
soriak
  • 672
  • 2
  • 13
  • 23
11
votes
1 answer

How to preserve file permissions with cmake "install directory" directive?

Prolog: I'm an idiot for missing this in the documentation cmake-2.8.10.2 How do you make cmake preserve the original file permissions when installing a directory? For the project at hand, I'd like it to essentially copy some directories from my…
smcdow
  • 699
  • 1
  • 7
  • 12