Build C ++ in debug mode with cmake bicode

Since I cannot go from release to debug build type, I wonder what I'm doing wrong. I work with Unix Make files.

Docs.biicode.com/c++/building.html says adding SET () to CMakeLists.txt adds variables to cmake.

I am new to cmake and biicode and I have tried everything:

ADD_DEFINITIONS(-DCMAKE_BUILD_TYPE=Debug) ADD_DEFINITIONS(-DCMAKE_BUILD_TYPE:STRING=Debug) SET(CMAKE_BUILD_TYPE Debug) target_compile_options(my_program PUBLIC $<$<CONFIG:Debug>:-Werror>) 

but gdb says "no debugging symbols were found."

Another way, like bii --help cpp states, is to switch to the cpp: build options that will be passed to cmake, but the call

 bii cpp:build -DCMAKE_BUILD_TYPE=Debug 

gives

 Building: cmake --build . -DCMAKE_BUILD_TYPE=Debug Unknown argument -DCMAKE_BUILD_TYPE=Debug 

but call directly

 cmake -DCMAKE_BUILD_TYPE=Debug --build . 

works fine and i don't know how to reorder in bii cpp:build .

Is this all a misconception, a syntax error, or something else wrong? What is the best place to change between Debug and Release?

+6
source share
1 answer

From biicode docs , it looks like you need to use the bii cpp:configure command to pass CMake arguments, not bii cpp:build .

As @ruslo commented, it was nice to set CMAKE_BUILD_TYPE inside the actual CMakeLists.txt ( see his answer for more details), so you probably want to:

 bii cpp:configure -DCMAKE_BUILD_TYPE=Debug bii cpp:build 

I understand that you said that you are working with Unix makefiles, but if you use a generator with several configurations (for example, Visual Studio), the type of assembly is not set during configuration. Rather, it is installed during assembly. In this case, I would expect the biicode commands to be more similar:

 bii cpp:configure -G "Visual Studio 12 Win64" bii cpp:build --config Debug 
+10
source

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


All Articles