<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>By default I would like to set CMAKE_BUILD_TYPE=Release (inside CMakeLists.txt) if the user has not defined CMAKE_BUILD_TYPE himself (e.g. as command-line option: cmake . -DCMAKE_BUILD_TYPE=Debug). Is there a best practice how to do this in CMake? I have been searching the web to see how other people achieved this and I found that many people use code like this:</div><div><br></div>if(NOT CMAKE_BUILD_TYPE)<br>        set(CMAKE_BUILD_TYPE "Release" CACHE STRING<br>        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."<br>        FORCE)<br>endif()</div><div dir="ltr"><br></div><div>I used this code myself in one of my projects but I recently discovered that this code causes issues when compiling with clang-cl on Windows.</div><div><br></div><div>Greetings,</div><div>Kim</div></div></div></div></div>