From: Дмитрий Архипов (grisumbras_at_[hidden])
Date: 2024-03-22 17:57:27


пт, 22 мар. 2024 г. в 20:32, Hassan Sajjad <hassan.sajjad069_at_[hidden]>:
>>
>> Do I understand correctly, that I would have to change the build
>> script (since it's a cpp file, is build source file more fitting?) to
>> build a new configuration?
>
> Yes. Do you think it is wrong? Why? How do you envision it?

Consider this b2 project:

# jamroot.jam
exe main : main.cpp ;

In order to build it in debug and release I would call b2 like this:

b2 variant=debug,release

With a similar CMake project:

#CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(proj LANGUAGES CXX)
add_executable(main main.cpp)

Building debug and release (using a single config generator) is done with e.g.
cmake -S. -Bbuild/debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug
cmake -S. -Bbuild/release -DCMAKE_BUILD_TYPE=Release
cmake --build build/release

Neither b2 nor CMake requires any changes to build scripts to build
different configurations.