From 69f178b347ee23ce1f8a09d953e259c96ca96a2b Mon Sep 17 00:00:00 2001
From: Teon Banek <teon.banek@memgraph.io>
Date: Fri, 6 Oct 2017 10:41:03 +0200
Subject: [PATCH] Force CMake to recheck external project source

Reviewers: mferencevic, buda

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D867
---
 libs/CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
index ebf19e136..e75b877b9 100644
--- a/libs/CMakeLists.txt
+++ b/libs/CMakeLists.txt
@@ -56,6 +56,12 @@ function(add_external_project name)
                                  -DCMAKE_INSTALL_PREFIX=${source_dir}
                                  ${KW_CMAKE_ARGS}
                       INSTALL_COMMAND ${KW_INSTALL_COMMAND})
+  # Force the build step (which will check if the source changed) by removing
+  # the stamped build file.
+  ExternalProject_Add_Step(
+    ${name}-proj force-build
+    COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/src/${name}-proj-stamp/${name}-proj-build
+    DEPENDERS build ALWAYS 1)
 endfunction(add_external_project)
 
 # Calls `add_external_project`, sets NAME_LIBRARY, NAME_INCLUDE_DIR variables