From 1f3849ce614aeae5fda742beffe5558e7c2a8b71 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sat, 3 Jan 2015 12:02:56 -0800 Subject: [PATCH] CMake: Clobber the top-level config.h before we build. If you use the same source directory for in-tree Autotools or Nmake builds and out-of-tree CMake builds you can end up with a conflicting config.h a the top of your source tree. Try to remove it in CMake before building our config.h Ping-Bug: 10301 Change-Id: I7ebeb31c92022fd28cbfca05fdb6931ffa2d9cae Reviewed-on: https://code.wireshark.org/review/6282 Reviewed-by: Gerald Combs --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 125d3008fa..8d8f7c2532 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -915,6 +915,16 @@ endif() set( VERSION ${PROJECT_VERSION} ) set( configure_input "Built with CMake ${CMAKE_VERSION}" ) configure_file(${CMAKE_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_BINARY_DIR}/config.h) + +if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + # Try to run before anything else. Ideally we'd just use add_custom_command(... PRE_BUILD) + # but that only works for Visual Studio. As it is this likely has a race condition. + add_custom_target(clean_other_build_system_conflicts ALL + COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_SOURCE_DIR}/config.h + DEPENDS ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/version.h + ) +endif() + set( IN_FILES adns_dll.rc capchild/doxygen.cfg.in