I've a C++ CMake project that I handle with Visual Studio 2022. I've tried to change the code during the debug and to click the "hot reload" button, but I've the following messsage:
Edits were made which cannot be compiled
And in the Visual Studio output window There's the following message:
'Canvas.cpp' in 'mylib.dll' was not linked with Edit and Continue enabled. Ensure that /INCREMENTAL linking is enabled, and the /EDITANDCONTINUE directive is not ignored.
What's the correct way to do it in a CMakeLists.txt
, considering that it will be a cross-platform project?
This is my CMakeLists.txt
:
cmake_minimum_required (VERSION 3.18)
project (my-project)
add_definitions (-DMY_PROJECT_EXPORTS)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTOUIC ON)
set (CMAKE_AUTORCC ON)
find_package (Qt5 COMPONENTS Core Gui Widgets REQUIRED)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../..)
set (PROJECT_SRC
# A bunch of files, i.e.
Private/Canvas.cpp
Private/View.cpp
Private/Scene.cpp
)
add_library (${PROJECT_NAME} SHARED ${PROJECT_SRC})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_link_libraries(${PROJECT_NAME} PUBLIC
Qt5::Widgets
Qt5::Gui
)