Questions tagged [cmake-modules]

Use this tag for questions regarding CMake modules that are part of the CMake distribution, or loading custom CMake modules into the current CMake context.

CMake Modules are CMake source files (typically .cmake files) that can be loaded into the current context using the include() command. CMake provides many modules that can be used out-of-the-box; these are split into two general types:

  • Utility modules
  • Find modules

Utility modules are loaded using the include() command, while Find modules are loaded by calling the find_package() command. Custom user-defined modules can also be written and loaded in a similar manner, but their location must be specified in the CMAKE_MODULE_PATH variable.

132 questions
0
votes
0 answers

Create external module import files

I am converting a project to stop using Visual Studio Project Files and switch to using cmake. The project is already a few years old, and makes use of custom precompiled external libraries, located outside the code tree: src/     ... source tree…
Trauma
  • 173
  • 1
  • 9
0
votes
1 answer

cmake check if a public field exist in class

// some_library.h class MyLib { public: int field_a; int field_b; // Only available on some versions int field_c; // Only available on some versions int ...; }; A library I'm using have a variable number of public fields depending on…
Curious Learner
  • 343
  • 2
  • 9
0
votes
0 answers

properties of custom target

I'm using add_cusmtom_target to do a custom build, but what properties of this target have? Perticually how can I get the list of dependencies listed in the target: add_custom_target(exsdk COMMAND echo DEPENDS foo.jar bar.jar) get_target_property(D…
fluter
  • 13,238
  • 8
  • 62
  • 100
0
votes
0 answers

cmake running through shell script gives error could not find a package configuration file

Trying to cross compile QT app. After inherit qt5 stuffs in SDK and exporting environment, I am able to build application successfully by invoking cmake and make command manually on the terminal. But I am not able to build the same application by…
SK17
  • 182
  • 4
  • 15
0
votes
0 answers

UBUNTU: no package glpk4.65 (.pc file) found

I'm working on a project using the GLPK solver. However, I'm having problems while trying to compile it. I'm using this to find the package in my computer: find_package(PkgConfig REQUIRED) pkg_check_modules(GLPK REQUIRED…
0
votes
2 answers

Getting "Could not find cmake module file: CMakeDetermineVersionCompiler.cmake" with cmake in linux

I'm getting Could not find cmake module file: CMakeDetermineVersionCompiler.cmake after installing cmake via script from website. What am I missing and where/what commands to run to fix this issue. install cmd: sudo ./cmake.sh --prefix=/usr/local/…
Mr.UNOwen
  • 163
  • 1
  • 1
  • 14
0
votes
2 answers

CMake: Using add_subproject with a library using Include ends up in wrong relative path

Global CMakeLists.txt This CMakeLists.txt compiles a few C++ files (Qt5/...) with MOC and is not 'special' in any regards. The code in question is…
qknight
  • 866
  • 10
  • 23
0
votes
0 answers

cmake CMAKE_PREFIX_PATH not working with set()

I have an external SDK which has all the libs and includes on. Now to make it work, I need to set CMAKE_PREFIX_PATH with my path, so I'm trying to set the variable inside of CMake file like this: set(CMAKE_PREFIX_PATH "/my/path/to/SDK") But for…
Mircea
  • 1,671
  • 7
  • 25
  • 41
0
votes
0 answers

CMake not finding Open MPI Installed through Homebrew

I have installed Open-MPI using homebrew, using brew install open-mpi. If I run mpic++ main.cpp in the command line, the code is compiled correctly. I can then run it using mpirun a.out. Now the issue is, when I create my CMakelists.txt file in…
Convex Leopard
  • 121
  • 1
  • 12
0
votes
1 answer

Find secondary dependencies in CMake config files

Following modern CMake guidelines (e.g. see https://www.slideshare.net/DanielPfeifer1/effective-cmake, particularly slide 46), I am trying to write out a PkgConfig.cmake file for my Pkg. Pkg depends on Foo which in turn depends on Bar. Neither Foo…
raovgarimella
  • 166
  • 1
  • 8
0
votes
1 answer

Does CMake find_path / find_library search for _ROOT by default?

Upon reading about CMake policy 74 - https://cmake.org/cmake/help/latest/policy/CMP0074.html [...] now searches prefixes specified by the _ROOT CMake variable and the ROOT environment variable. Package roots are maintained as a stack so nested…
Chaitanya Bapat
  • 3,381
  • 6
  • 34
  • 59
0
votes
2 answers

What modules should be included in CMakeList.txt for Approximate Nearest Neighbor Searching?

I have compiled ANN-library and need to use it in a C++ file for segmentation evaluation I have set the CMakeList.txt, which is using ITK and ANN libraries as follows: PROJECT(EvaluateSegmentationResult) cmake_minimum_required(VERSION…
S.EB
  • 1,966
  • 4
  • 29
  • 54
0
votes
1 answer

CMake: How to implement version check in a config file?

I Customize CMake package configure file OpenCLConfig.cmake for opencl-icd. refer to Create CMake XXConfig.cmake let other cmake project invoke Now, I encounter a problem: How to implement version check in a config file. I create…
curlywei
  • 682
  • 10
  • 18
0
votes
0 answers

cmake : How to copy prebuilt binary or script file instead of compiling anything local

I have shell scripts in some sub projects. These projects do not compile anything. What I want is to copy the scripts and / or pre-built binaries to the same location as it would if it compiled a local app. #configure_file(test.sh test.sh…
preetam
  • 1,451
  • 1
  • 17
  • 43
0
votes
1 answer

add_custom_command for copy *.y to *.txt file

I am trying to copy the generated *.y output (plane luma values, no header info) to text file using the add_custom_command CMake command. How can I add the copy command in add_custom_command? I want to redirect the generated *.y output to text file.…
jailaxmi k
  • 89
  • 3
  • 11
1 2 3
8
9