File: DisallowInSourceBuilds.cmake

package info (click to toggle)
warzone2100 4.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 660,320 kB
  • sloc: cpp: 676,209; ansic: 391,201; javascript: 78,238; python: 16,632; php: 4,294; sh: 4,094; makefile: 2,629; lisp: 1,492; cs: 489; xml: 404; perl: 224; ruby: 156; java: 89
file content (11 lines) | stat: -rw-r--r-- 526 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
cmake_minimum_required(VERSION 3.16...3.31)

function(DisallowInSourceBuilds)
	get_filename_component(_real_source_dir "${CMAKE_SOURCE_DIR}" REALPATH)
	get_filename_component(_real_binary_dir "${CMAKE_BINARY_DIR}" REALPATH)
	if(_real_source_dir STREQUAL _real_binary_dir)
		message(FATAL_ERROR "In-source builds are not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt from the source directory.")
	endif()
endfunction()

DisallowInSourceBuilds()