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

Why don't I need add boost::shared_ptr to target_link_libraries when linking to Boost::filesystem?

Recently, I was learning CMake using ttroy50/cmake-examples. But when I learning H-third-party-library, I meet a problem! This tutorial said we can use find_package function to find third party libraries. We have the following main.cpp: #include…
Ning Ben
  • 35
  • 6
1
vote
1 answer

how to link shared libs in windows and linux in cross compile cmake build

I have a c++ third party shared library "My3rdParty" in windows and linux that I need my own c++ shared library "MySharedLib" to link to. My build needs to build on windows for windows, on windows for linux and on linux for linux. I created a…
1
vote
0 answers

What is the problem, when I bulid ROS hector navigation

I am trying to use hector navigation in ROS to do navigation. But when I follow the steps, some problems occur. When I do cmake, the problem happened as following. Project 'ceres_catkin' tried to find library 'gflags'. The library is neither a…
唐啟實
  • 11
  • 1
1
vote
1 answer

CMake: path of CXX Compiler in Visual Studio 2019?

I am on Windows and I try to compile a C/C++ program using CMake-gui. I have Visual Studio 2019 installed on my PC. I set as Windows environment variable for CXX the following path: C:\Program Files (x86)\Microsoft…
toto_tata
  • 14,526
  • 27
  • 108
  • 198
1
vote
1 answer

Shared CMake scripts between multiple projects

I'm looking for a way to share CMake scripts between multiple projects. In a repo called somelib I have a cmake folder, and from the other projects I want to include the scripts in it. In the CMakeLists.txt of somelib I include many files from the…
ShellCode
  • 1,072
  • 8
  • 17
1
vote
0 answers

Compile and link library at once in CMake

I'm new in CMake enviroment. I have this project-structure tree: /my_proj │ ├── deps │   └── my_dep │   └── CMakeLists.txt ├── src │ └── main.cpp └── CMakeLists.txt Where my_dep is a git submodule used as dependency for my_proj…
1
vote
1 answer

CMake Error at cocos2d/cmake/Modules/CocosConfigDepend.cmake:94 (endmacro): Flow control statements are not properly nested

Hey I'm a newbie cocos 2d x developer, I'm just trying to get a "Hello World" project created in XCode for iOS. From the terminal I'm using the command cmake ../.. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos I keep getting these…
Will
  • 11
  • 1
  • 2
1
vote
1 answer

How to make CMake detect ar and nm if there is no dash after the toolchain prefix?

I'm working on a CMake toolchain file for the new LLVM/Clang based compiler from Texas Instruments (see ARM-CGT-CLANG-1). CMake properly detects that it's a clang based compiler if I simply set CMAKE_C_COMPILER to the correct path of the tiarmclang…
Arno Moonen
  • 1,134
  • 2
  • 10
  • 28
1
vote
1 answer

CMake Error: Unknown argument -VV when installing Trilinos

I am using the following code : #!/usr/bin/env bash module load cmake python boost phdf5 netcdf export F77='which mpif90 || /bin/true' export COPTFLAGS="-O1" export CC='which mpicc || /bin/true' export CXX='which mpicxx || /bin/true' export…
bdas
  • 21
  • 3
1
vote
0 answers

find_package python3 error on windows with missing Python3_SOABI

I am using cmake version 3.17 on windows with the following code to find the Python3 interpreter. set(Python3_FIND_VIRTUALENV FIRST) find_package(Python3 REQUIRED COMPONENTS Interpreter) For the python3 virtual environment, it fails with the…
Sirish
  • 9,183
  • 22
  • 72
  • 107
1
vote
2 answers

ExternalProject_Add for Makefile project error during build

I am trying to add Postgresql as a dependency for my project for which I am using ExternalProject module to download the source from github and build, but the build step fails when running from cmake (cmake --build .). Configure step seems to…
Eqbal
  • 4,722
  • 12
  • 38
  • 47
1
vote
0 answers

cmake configure_package_config_file does not add PATH_VARS correctly

I have two packages that are under the same catkin workspace I have package A and package B where B needs to get include files and library files of A. in CMakeLists.txt of A, I had set(TEST_VAR "TEST") configure_package_config_file( …
Brandon Lee
  • 695
  • 1
  • 10
  • 22
1
vote
1 answer

Could not find libgit2 in CMake

I am doing my first steps in CMake and I have a Hello World example where I would like to use libgit2. My directory structure is the following: - main.cpp - CMakeLists.txt - cmake/Modules/Findlibgit2.cmake - libs/libgit2/include/git2.h -…
Daniel Stephens
  • 2,371
  • 8
  • 34
  • 86
1
vote
1 answer

Make an external project available for find_package CMake

In my project I have a dependency "A" that has another library dependency "B", I'm trying to download and install the dependency B before A in order to clear the conflict. I'm using Externalproject_add, FetchContent_Declare and install, but it…
quetzalfir
  • 528
  • 7
  • 22
1
vote
1 answer

Path mismatch when including libraries with CMake

I am trying to include two libraries into my project to use them. I'm using CMake with CLion. The two libraries are: https://github.com/herumi/bls and https://github.com/herumi/mcl I got the following project setup: This is the main CMake…
raycons
  • 735
  • 12
  • 26
1 2
3
8 9