]> git.cworth.org Git - apitrace/commitdiff
Fix mixed in/out of source builds.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 8 Oct 2011 11:42:56 +0000 (12:42 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 8 Oct 2011 11:46:29 +0000 (12:46 +0100)
Mixing in/out of source builds is not really a good policy, but
something I do quite often due to convenience.

thirdparty/snappy/CMakeLists.txt

index 2ee896cb39039909c3d0a3bf80126ed9a733fcaa..bcacda7514a8acf632548d73fcff59e01d78d161 100644 (file)
@@ -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()