我想用 Clion
调试一个使用外部 makefile 创建的可执行文件。
我看到我可以在 Run/Debug Configurations --> Executable
中选择另一个可执行文件,但它会自动运行我的 CMakeLists
,我不想这样做(因为它失败了)。
我知道 Clion
目前不支持“使用现有 makefile 导入项目”。
有办法吗?
最佳答案
- 使用
Cmake
的add_custom_command()
和add_custom_target()
我调用了我的makefile
- 在
Clion
Run/Debug Configuration --> Executable
中,我从我的 makefile 中选择了已编译的可执行文件。
--- 编辑---
1.例子
add_custom_command(OUTPUT app_run.txt
COMMAND /bin/echo "Not building!"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_custom_target(app_run ALL
DEPENDS app_run.txt)
关于c++ - 如何使用 Clion 调试外部可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29328777/