Questions tagged [cmake-language]

CMake () input files are written in the “CMake Language” in source files named CMakeLists.txt or ending in a .cmake file name extension.

Official Documentation

Additional Resources

112 questions
0
votes
1 answer

cmake library - relative path fails but absolute path succeeds

I have a cmakefile that's very basic. This is the relevant portion: # The object files of ds set(DS_LIB_FOLDER ../../build/) set(DS_LIB ds) get_filename_component(DS_LIB_FOLDER_ABS "${CMAKE_CURRENT_SOURCE_DIR}/${DS_LIB_FOLDER}"…
Bob
  • 4,576
  • 7
  • 39
  • 107
0
votes
0 answers

What could be causing ESP IDF to not recognize the content of my included header files?

ESP - IDF not functioning as expected. I've been trying to work on esp32s3 and skainet using esp-idf(ide not the eclipse or vs code plugin) and I am facing this issue constantly. Issue: I have made a project but and at times the idf doesn't…
user21923894
0
votes
1 answer

How can I make a variable set by an external project added with add_subdirectory available to the scope that did add_subdirectory?

I have two separate git projects that I build using cmake. Project_A |CMakeLists_A.txt |foo.H In the CMakeLists_A.txt file, I define a variable that points to foo.H as follows: set(var_projectA ${CMAKE_CURRENT_SOURCE_DIR}/foo.H) I add…
Rob S
  • 27
  • 1
  • 7
0
votes
0 answers

CMake cannot find SDL2 no matter what I try

NOTE This is not a compile time issue this is a cmake generation-time issue. I've been trying to setup my environment so that cmake can find SDL2. I am on windows 11, with the latest versions of SDL2 (found here), SDL_image (found here) and SDL_ttf…
Nosh Ware
  • 11
  • 5
0
votes
1 answer

How to replace FetchContent_Declare to copy the already cloned local repo

We are using CMakeLists.txt for compiling our huge code base. We are cloning the repo at compilation stage, using FetchContent_Declare as below. FetchContent_Declare(miniz GIT_REPOSITORY https://github.com/richgel999/miniz.git GIT_TAG …
0
votes
0 answers

How can i link a custom library with Cmake?

im new in Cmake, im trying to link a library to a project using Cmake, the following code is this: code of the header: my_library.h #ifndef MY_LIBRARY #define MY_LIBRARY int get_random_number(); #endif implementation of the…
0
votes
1 answer

How to include asio boost in cmake project

I'm trying to include asio boost using CMakein my project but I'm getting this error. libraries linking is working in VS but I don't know how to link them in Cmake project. Working Solution with VS:- asio boost version: 1.24.0 VS…
user20541210
0
votes
0 answers

porting a C++ project to android using NDK-CMAKE

I am following this guideline to compile a c++ project. It compiles successfully (it shows *[100%] Built target MY_SERVICE). I can also observe that, it generates *.so library files. After defining the output directory i can see a file with…
Ashkanxy
  • 2,380
  • 2
  • 6
  • 17
0
votes
1 answer

CMAKE_INSTALL_MESSAGE variable won't silence file(INSTALL ...)

I have a part of code in CMake. It should copy files from source folder to a destination folder and I want it to be silent. According to the documentation set (CMAKE_INSTALL_MESSAGE NEVER) should make it quiet. But it doesn't. This is the code: #…
Mykola Tetiuk
  • 157
  • 3
  • 9
0
votes
1 answer

CMake Error: Target of type EXECUTABLE may not be linked into another target

I try to add GTest project to my solution. I have a project structure: my project structure I created Cryptograph and CryptographTests directories, after that created binTests and lib into CryptographTests. I have a few CMakeLists.txt…
0
votes
0 answers
0
votes
0 answers

file strings requires and filename and output variable in cmake

target_link_libraries(${PROJECT_NAME} serializer iothub_client iothub_client_mqtt_transport umqtt aziotsharedutil …
0
votes
1 answer

Define CMake target that acts as intermediate abstraction layer for another

I have two projects sharing some code. Both have their own tools for generating almost the same boilerplate code, which are defined as a CMake target that runs everything when imported (or used as dependency). Let's assume that it is called…
dunadar
  • 1,745
  • 12
  • 30
0
votes
0 answers

How to forward output from CMake execute_process to CMake's logs?

In my CMake file, I set up a Python test environment: execute_process( COMMAND pip install -U -r ${REQUIREMENTS} RESULT_VARIABLE STATUS ) The issue is, I usually don't need its verbose OUTPUT. So I want to optionally hide it. This is what I've…
Anton3
  • 577
  • 4
  • 14
0
votes
1 answer

How to set value by code to a CACHE variable defined by 3d party CMake?

In my project, the CMakeLists includes other cmake files from a library and those dependencies need some cache variables to be configured by user values. It is all working well if I define those values from the command line with the cmake…
ymoreau
  • 3,402
  • 1
  • 22
  • 60