Clion - how to build cmake to support debug/release
Answered
Hey
I'm trying to run this code in cmakelist file but no matter what mode I'm in it always says that I'm in debug.
if (CMAKE_BUILD_TYPE MATCHES Debug)
message(" ")
message("CMAKE IN DEBUG MODE")
message(" ")
elseif(CMAKE_BUILD_TYPE MATCHES Release)
message(" ")
message("CMAKE IN RELEASE MODE")
message(" ")
endif ()
What am I doing wrong here?
Regards
Dariusz
TIA
Please sign in to leave a comment.
Hello! You need to create another CMake profile for Release in File | Settings | Build, Execution, Deployment | CMake:
Yup thats what I did, I changed the drop down menu in right upper corner from debug to release and so on but still no luck. Its an old 1 year + project tho, maybe there are some "old glitches" ? Hmmm
I'm using MSVC as compiler. The strange thing it is that if I open the project in MSVC and run it there, it all works properly.
Is the cmake-build-release subfolder created after you add the Release CMake profile in File | Settings | Build, Execution, Deployment | CMake? Do you see two tabs (Debug and Release) in the CMake tool window after that like on my gif?
Yup everything works, kicked off eventually. Thanks for help!