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>
This commit is contained in:
Gerald Combs 2015-01-03 12:02:56 -08:00 committed by Gerald Combs
parent 4d3acd9af8
commit 1f3849ce61
1 changed files with 10 additions and 0 deletions

View File

@ -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