summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2011-10-08 12:42:56 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2011-10-08 12:46:29 +0100
commita384e61261c518ab374e4965261bc6ce23f741b0 (patch)
tree6dee930fdce2a7cab722754c33822d31bfd4a672
parentfe97936e69656c29be5e9b496cf8f1b2e73695b7 (diff)
Fix mixed in/out of source builds.
Mixing in/out of source builds is not really a good policy, but something I do quite often due to convenience.
-rw-r--r--thirdparty/snappy/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/thirdparty/snappy/CMakeLists.txt b/thirdparty/snappy/CMakeLists.txt
index 2ee896c..bcacda7 100644
--- a/thirdparty/snappy/CMakeLists.txt
+++ b/thirdparty/snappy/CMakeLists.txt
@@ -44,3 +44,12 @@ add_library (snappy_bundled STATIC
set_target_properties (snappy_bundled PROPERTIES
COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
)
+
+# If we're doing an out of source build remove any config.h from the source tree.
+if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
+ add_custom_command (
+ TARGET snappy_bundled
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_SOURCE_DIR}/config.h
+ )
+endif()