Preprocessor macro Debug flag Clion Linux
Completed
I've been trying to figure out how to get CLion to only run certain bits of code if I'm debugging. I tried setting debug flags for cmake in my CMakeLists.txt, but that doesn't seem to work. I tried setting it in CMakeLists.txt without luck
I have :
set(CMAKE_CXX_FLAGS_DEBUG "-DEBUG")
But, don't think that's right. I currently have a macro defined that I can change manually for debugging, but that isn't ideal. How would I go about setting a debug flag correctly on Linux?
Please sign in to leave a comment.
Figured out how to do it.
This worked for me after I tried lots of other CMake options to do this. Replace XML_parser in the above answer with your executable/target name.
These lines worked for me:
Taken from here (slightly modified).