aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGerald Combs <gerald@zing.org>2015-01-03 12:02:56 -0800
committerGerald Combs <gerald@wireshark.org>2015-01-03 20:53:09 +0000
commit1f3849ce614aeae5fda742beffe5558e7c2a8b71 (patch)
treeee8cd29dc2d9826b729763bad34379714605b2ad /CMakeLists.txt
parent4d3acd9af818089b91e779b54152b82367080d7c (diff)
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 <gerald@wireshark.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
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