The right way to get out of the original assembly in a multi-part cmake project

I use cmake to build, test and install my project. My method is a little rude: I use such scripts to get the assembly outside the source:

DIR=debug_build &&
rm -fr ./${DIR} &&
mkdir -p ${DIR} &&
cd ${DIR} &&
cmake -D CMAKE_BUILD_TYPE=Debug $@ .. &&
make 

I think I could at least put it in a makefile, but isn't it strange to use a Makefile to run cmake to create new Makefiles and run another make?

What is the right way to do this? Does cmake have the ability to avoid calling "cd"?

This has become even more complicated lately, since I used a library that I would like to compile, test and distribute separately. I want to avoid duplicating everything that I have in my top CMakeLists.txt.

How to do this with cmake?

+3
3

, CMake . Makefile CMake.

, Makefile make, Visual Studio. , , .

+1

, -, . ( ) ( unix, Windows), , . /build , CD, cmake, build, .

+1

CMake GUI, , .

0

Source: https://habr.com/ru/post/1714357/


All Articles