summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-mrproper.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-19 16:25:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-19 16:25:44 +0200
commitb454c962f4784ed06908f668b66376600d21dc52 (patch)
tree2047c3cd9a21e8a75f01fec630966938e101fea2 /cmake/opentrack-mrproper.cmake
parenta6d54f7ed35d972793e819eae23eadc17e4bca50 (diff)
cmake: move from build to mrproper and platform
Diffstat (limited to 'cmake/opentrack-mrproper.cmake')
-rw-r--r--cmake/opentrack-mrproper.cmake33
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/opentrack-mrproper.cmake b/cmake/opentrack-mrproper.cmake
new file mode 100644
index 00000000..faa11bd4
--- /dev/null
+++ b/cmake/opentrack-mrproper.cmake
@@ -0,0 +1,33 @@
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+function(cleanup_build_dir)
+ file(GLOB_RECURSE files LIST_DIRECTORIES TRUE RELATIVE "${CMAKE_BINARY_DIR}" "*")
+
+ set(files_ "")
+
+ set(got-cache FALSE)
+
+ foreach(i ${files})
+ if(i STREQUAL "CMakeCache.txt")
+ set(got-cache TRUE)
+ else()
+ list(APPEND files_ "${CMAKE_BINARY_DIR}/${i}")
+ endif()
+ endforeach()
+
+ if(NOT got-cache)
+ message(FATAL_ERROR "sanity check failed")
+ endif()
+
+ # let's hope nothing bad happens
+ file(REMOVE_RECURSE ${files_})
+
+ #execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET)
+endfunction()