diff --git a/src/Mod/TechDraw/Gui/CMakeLists.txt b/src/Mod/TechDraw/Gui/CMakeLists.txt index eb9660bcd6..722cc0d3c3 100644 --- a/src/Mod/TechDraw/Gui/CMakeLists.txt +++ b/src/Mod/TechDraw/Gui/CMakeLists.txt @@ -6,9 +6,11 @@ endif(MSVC) # In previous versions this target copied mtextedit.h to the binary directory that causes # automoc to generate linking errors. -if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mtextedit.h) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/mtextedit.h) - execute_process(COMMAND "${CMAKE_COMMAND}" -E touch_nocreate "${CMAKE_CURRENT_SOURCE_DIR}/mtextedit.h") +if(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/mtextedit.h) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/mtextedit.h) + execute_process(COMMAND "${CMAKE_COMMAND}" -E touch_nocreate "${CMAKE_CURRENT_SOURCE_DIR}/mtextedit.h") + endif() endif() include_directories(