Issue
In this answer, it says Debug is the default cmake build configuration.
But I have a different observation:
I have following in my CMakeLists.txt to choose debug and release versions of a lib according to the current build configuration.
target_link_libraries(MyApp debug Widgets_d)
target_link_libraries(MyApp optimized Widgets)
It seems that when I invoke cmake without specifying -DCMAKE_BUILD_TYPE
, Widgets
is used instead of Widgets_d
(When I delete Widgets
and try to build, Make complains that lib is not there). So that means by default the build configuration is optimized, not debug.
So what actually is the default build configuration? If it is debug, what could be wrong with my CMakeLists.txt?
Solution
target_link_libraries with optimized
keyword corresponds to all configurations, which are not debug.
Try adding message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
to your CMakeLists.txt to see the actual build type (I suppose it should be empty).
Answered By - Mikhail Maltsev Answer Checked By - Marie Seifert (WPSolving Admin)