我需要帮助用debug flag编译我的项目 .
我在build文件夹中编译了 -DCMAKE_BUILD_TYPE=Debug ..
.
我能够在编译后运行二进制文件 . 但是,Debug标志未打开 . 我有点陷入困境 . 任何善良的人都愿意对此提出一些建议或指示?
我的构建树是这样的:
project
|------ CMakeLists.txt (The main Cmake)
|------ ProjectA
| |----- src
|.c files
| |----- include
|.h files
| |----- CMakeList.txt
|------ ProjectB
| |----- src
|.c files
| |----- include
|.h files
| |----- CMakeList.txt
|
|------ build
| |----- ...
|------ bin
| |---- executables
我在项目A和B中设置了我的cmake标志:
#cmake output directory
...
#compiler
...
set(CMAKE_C_FLAGS "... -DDEBUG ...")
#Linking
...
#add executables
...
我的顶级CMakeLists.text是这样的:
project(..)
...
add_subdirectory(ProjectA)
add_subdirectory(ProjectB)
1 回答
在主CMakeLists.txt中添加以下行
生成Makefile: