Category "cmake"

Prevent clang tidy to report warnings on Boost Test headers

I have a Cmake project that uses Boost.UnitTest for testing. When I do static analysis with clang-tidy it reports some warnings from the Boost.UnitTest headers.

Linking issues "relocation against `g_GIT_SHA1' in read-only section `.text'" and "undefined reference to `g_GIT_SHA1'"

I was trying to follow the procedure in this answer https://stackoverflow.com/a/4318642 with a test: CMakeFile.txt #cmake version setup cmake_minimum_required(V

CMake & MinGW Compilation on Windows, without needing the -G "MinGW Makefiles" flag

I want to build my C++ applications from the Windows PowerShell command line using CMake and MinGW. When I do this in the "normal way," with these commands: m

Compilation issues with a simple ImGui(GLFW+OpenGL3) program on Linux

I am getting the following error while compiling a simple imgui+glfw+opengl3 program on GCC 11.2.0 on Pop!_OS (Ubuntu): [build] In file included from ../externa

Pure OpenGL on Windows? [duplicate]

I want to use OpenGL without GLFW, the docs say that I need to add opengl32.lib to linker dependencies. How do I specifically import OpenGL an

CMake 'undefined reference' error with CERN-ROOT

I'm writing a small addition to CERN ROOT and now can't get rid of 'undefined reference' errors on every function from ROOT that I use (and my classes too). Can

TensorFlow static C API library - how to link with 10 sub-dependencies?

I am trying to link with static C API version of the TensorFlow library. I built the static library using the following commands: // get the sources git clone h

FetchContent vs ExternalProject

I am building a project with Cmake and use FetchContent to manage dependencies. For several reasons I cannot depend on system-wide installed packages, so this p

Finding Protobuf package with CMake

I cannot seem to get CMake to consistently find my protobuf package. I would like to include the protobuf source and build it as part of my project. I'm using p

Show compiler command line of CMake with Visual Studio 2019

I am using open folder functionality of VS2019, and I would like to see flags being used to compile my code. Compilation database does not seem to be generated

How to compile HLSL Shaders during build with Cmake?

I'm working on a d3d application and i would like to compile my .hlsl shaders during to build using cmake. I have no idea where to start. this is my current CMa

How to use Clang-CL LLVM with VS2019 CMAKE?

As of writing clang has this documentation on their user manual for Visual Studio: cmake -G"Visual Studio 2017" -T LLVM .. This doesn't work. I get this mess o

Can't use command make for makefile on Visual Studio Code

Backround I have been coding (mostly C) on Linux so far but i want to be able to code on Windows as well. So i searched for a better editor than notepad and fou

"In-source builds are not allowed" in cmake

I'm new to cmake, and I'm only using it to install opencv on my ubuntu linux. Here's the command I ran: cmake -DCMAKE_BUILD_TYPE=Release DCMAKE_INSTALL_PREFIX=/

What's the right cmake command to cross-compile for Raspberry Pi from M1 Mac?

My title seems general but I need to compile a project for my Raspberry Pi 3b. I want to use Telegram's Bot API server on it, but it takes a lot of time to comp

Calling existing make command in cmake file

I have a large project with multiple subdirectories. In the parent directory, I have a CMakeLists.txt file which calls functions defined in other cmake files in

How to link shared library on linux using cmake?

How to link shared library on linux platform? I downloaded sfml library using apt cmd and I tried to run simple example: main.cpp #include <SFML/Graphics.hpp

How do I stop project with boost dependency finding the wrong ${Boost_INCLUDE_DIRS} location, when building in Visual Studio 2019 with CMake

I am attempting to build the fruit library - https://github.com/google/fruit, in Visual Studio 2019 When I ran the install step for the first time it was unable

Why does CMake set -no-fat-lto-objects when I enable LTO/IPO?

I'm enabling IPO (inter-procedural optimization) for a C compilation of mine, using CMake: set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)

Copying assets directory from source to build directory in CMake

I am trying to write a game for practice in C++. I am using CMake for this, and my project gets built in a separate build directory automatically by my IDE. How