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

How to request a password for GIT_REPOSITORY using HTTPS URL

The URL understood by the git command can be in the format HTTPS or SSH. In CMake, using ExternalProject_Add for the specified GIT_REPOSITORY any URL understood by the git command may be used. Using HTTPS user credentials must be given in order to…
linuxUser123
  • 529
  • 3
  • 17
10
votes
6 answers

CUDA compile problems on Windows, Cmake error: No CUDA toolset found

so I've been successfully working on my CUDA program on my Linux but I would like to support Windows platform as well. However, I've been struggling with correctly compiling it. I use : Windows 10 Cmake 3.15 Visual Studio 2017 CUDA Toolkit…
Mineral
  • 197
  • 1
  • 1
  • 10
10
votes
2 answers

CMake: how to get target location for install rule

I have a CMakeLists.txt that does this: get_target_property(myloc mytarget LOCATION) It used to work fine, but CMake 3.0 deprecated using LOCATION (see https://cmake.org/cmake/help/v3.0/policy/CMP0026.html). So I tried using a generator…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
10
votes
3 answers

CMake cannot open "ucrtd.lib"

My problem is similar to this one: Problems generating solution for VS 2017 with CMake, but the solution doesn't work for me. When run cmake in Developer Command Prompt for VS 2017, I got the error (from CMakeError.log): LINK : fatal error LNK1104:…
shingo
  • 18,436
  • 5
  • 23
  • 42
10
votes
2 answers

How can I get `cmake` work in JetBrains CLion to compile Emscripten/WebAssembly?

I am trying to properly setup JetBrains CLion 2019.1 to build WebAssembly from C source code. I've tried almost everything, however, nothing works. I do not get any WebAssembly build. All I get is: WasmText.js WasmTest.js.mem WasmTest.cbp When I…
Pinke Helga
  • 6,378
  • 2
  • 22
  • 42
10
votes
1 answer

How to register an install directory in the cmake package registry

Assume I have written a library that I can build an install via cmake. And I also have a Config.cmake file that can locate all necessary files (library, headers, ...) and exports a target for the library. If I want to use the library…
AlbertM
  • 1,246
  • 14
  • 25
10
votes
2 answers

Compiling error using make install to install OpenCV 4 in Raspbian Raspberry Pi 3+

`Hello, I have installed OpenCV on the Raspberry a couple of times. However, since everything is constantly evolving (OS, libraries, etc...). This time I am getting the following error: -- Installing:…
Puértolas Luis
  • 235
  • 1
  • 2
  • 13
10
votes
1 answer

CMake - how to build Boost after downloading it with FetchContent?

My goal is to download the Boost repository if it isn't found and then build it the default way, i.e. using boostrap and b2 tools. I know, I can download it like this: include(FetchContent) FetchContent_Declare( Boost PREFIX…
Eenoku
  • 2,741
  • 4
  • 32
  • 64
10
votes
1 answer

Include Pistache in C++ project

Apologies for the fact this is a very noob question but I am fairly new to C++. I'm building a RESTful service with pistache. I have checked it out and got the examples running within the project itself but am now trying to import/include the…
wmash
  • 4,032
  • 3
  • 31
  • 69
10
votes
2 answers

java.lang.UnsatisfiedLinkError: dlopen failed: library not found

I am trying to build my Android (native) project using cmake (migrating it from gradle experimental plugin where it used to build and run fine). I have some native code(will call it 'a') which uses another external prebuilt library code (will call…
smitt
  • 304
  • 1
  • 3
  • 8
10
votes
1 answer

vcpkg + cmake + visual studio not working

I have a cmake-based C++ project using boost and zmq libraries. I'm trying to build it on Windows using Visual Studio Community 2017 and vcpkg. I installed vcpkg following the instructions on the project page. Now I can see the required packages…
fferri
  • 18,285
  • 5
  • 46
  • 95
10
votes
2 answers

How to write Cmake for multiple .cpp files and headers in different folders ?

i have some .cpp files and their headers as includes in separate folders how i should write CMakeLists.txt for them . i can't write their address so compiler gets error like this -> no such file
mmdii
  • 165
  • 1
  • 1
  • 8
10
votes
1 answer

[[maybe_unused]] attribute not working

I am trying to ignore the unused parameter warning using the new c++17 attribute [[maybe_unused]], as below. int main([[maybe_unused]] int argc, char** argv) { //... } But I still get warning: unused parameter ‘argc’ [-Wunused-parameter] with…
Anubis
  • 6,995
  • 14
  • 56
  • 87
10
votes
1 answer

C++ AddressSanitizer with CMakeLists.txt results in asan errors

Trying to use the AddressSanitizer tool (ASan) on my C++ project, I get a very verbose output full of undefined reference to '__asan_report_store8' and undefined reference to '__asan_report_load8', and others like __asan_stack_malloc_2. My project…
BoltzmannBrain
  • 5,082
  • 11
  • 46
  • 79
10
votes
1 answer

Using cmake to build a static library of static libraries

I'm trying to create a static library of static libraries. Here's my CMakeLists.txt cmake_minimum_required(VERSION 2.8) project(myRtspClient) add_subdirectory(../third_party/Base64_live555 base64_live555) add_subdirectory(../third_party/md5…
PPP
  • 1,279
  • 1
  • 28
  • 71