We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d9e8eb commit 05ee391Copy full SHA for 05ee391
CMakeLists.txt
@@ -1,5 +1,7 @@
1
cmake_minimum_required(VERSION 3.26)
2
3
+include(cmake/PreventInSourceBuilds.cmake)
4
+
5
project(
6
Template-CPP
7
VERSION 0.1.0
cmake/PreventInSourceBuilds.cmake
@@ -0,0 +1,9 @@
+# ---- In-source guard ----
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+ message(
+ FATAL_ERROR
+ "In-source builds are not supported. "
+ "You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first."
8
+ )
9
+endif()
0 commit comments