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

67 questions
0
votes
0 answers

.phony target alternative in cmake to create a custom target

suppose Makefile having a phony target like this .PHONY : run_my_command - - - - - - - - - - - - - - - - - - - - we can directly run only this .phony target in Makefile from command line by giving the below command make -f Makefile…
0
votes
0 answers

How to only preprocess and link some of the files in cmake

I want some of my files only to be preprocessed and linked(.ld files) and others(.c) has to be fully compiled. The ld file contents are distributed across the project. It has to be preprocessed into single ld file. How to do this in cmake ?
0
votes
0 answers

Adding a library with CMake with generated source files

tl;dr; When using ADD_LIBRARY in CMake it will check during cmake .. that all the source files exist. I have some that are generated during compile time. Is there a way to force CMake to ignore the missing files since they will exist when they are…
Questionable
  • 544
  • 2
  • 20
0
votes
0 answers

Cmake command for console output

I want to know whether any cmake command available for outputing the comments into console when make is executed. The command message() outputs the data into cmake application console. I want to print the command in the console when make is…
0
votes
0 answers

how to include directory based on condition in cmake

I am using windriver compile. I followed below steps set(var_1) if(var_1) target_include_directories(cfar PRIVATE ${APP_DIR}/z7b/variant_1) else target_include_directories(cfar PRIVATE ${APP_DIR}/z7b/variant_2) endif()
0
votes
1 answer

Why are files not found from parallel folders CMake

To have my .cpp and .h files a little bit sorted up pending on their responsibilitie I decided to put them into seperate folders I used the following structure: root | -CMakeLists.txt [rootCmakeList] src | -main.cpp .......| ....... …
Zaragesh
  • 15
  • 4
0
votes
0 answers

Another one; Undefined symbols for architecture x86_64 after running cmake commands

After including some a shared library to my smaller C code to call some functions of the library, and then running cmake -DCMAKE_BUILD_TYPE=Release .. and cmake --build I get the following error; Undefined symbols for architecture x86_64: …
Fnechz
  • 91
  • 6
0
votes
1 answer

How to create cmake library that expects an external header file

I feel like I'm missing some key idea with this one. I have a library that I'd like to create a CMakeLists.txt file for. I want to link against it with different applications. This library expects a conf.h file to be defined. The application has to…
triplebig
  • 392
  • 6
  • 20
0
votes
0 answers

CMake, Visual Studio and unresolved external symbols

I am trying to run a program in Visual studio, while building it with cmake, however, I get "Unresolved external sumbol" errors in regards to a few libraries that I am trying to link. I understand what kind of problem I am facing, but I am new to…
0
votes
1 answer

How to add_dependencies between projects in cmake

include_directories(${CMAKE_CURRENT_SOURCE_DIR}) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} source) project(abc) #a_certain_source_file.cpp is a generated file built by another project. add_library(${PROJECT_NAME} STATIC ${source}…
badri
  • 444
  • 2
  • 5
  • 14
0
votes
0 answers

How can I force cmake to statically link a specific library even when BUILD_SHARED_LIBS is set to ON

How can I force a library to link statically even if I want other libraries to link dynamically. I want to link most of my libraries dynamically, but one of my libraries requires static linking. Is there a way that I can force any link to that…
0
votes
0 answers

GLOB_RECURSE grabbing the wrong source file

My source project directory is something like this, |── CMakeLists.txt | ├── src | | | | | | | └── a | | | | | |__ a.cpp | | | | | | | └── b | | | |__ b.cpp | |___test | |__test.cpp I need to make a…
0
votes
1 answer

cmake use wildcard for find_library NAMES option

In cmake to find a library we use find_library(MyLibrary_LIBRARY NAMES mylibrary mylibrary10 mylibrary11 HINTS /path/to/library). This command tells cmake to find a file named mylibrary.so or mylibrary10.so or mylibrary11.so (or files with .lib…
huangzonghao
  • 291
  • 2
  • 9
0
votes
0 answers

Android Studio Play Asset Delivery CMake Error

I could not upload my app because its huge. I am trying to do Play Asset Delivery but build fails with this error message and I am not sure what this means. I Google'd it and it were not Android Studio related and I do not fully understand what it…
Bob
  • 17
  • 5
0
votes
1 answer

dynamic source list for CMake

I try to configire my CMake project so it can accept dynamic source list. But for some reason I get empty list from file function. So I've tried to execute the same operation in 2 ways: [1] static list (the unwanted way) set(VARIANT_A…
folibis
  • 10,456
  • 4
  • 39
  • 82