Files
composable_kernel/cmake/PreventInSourceBuilds.cmake
Mateusz Ozga 20d6b58b5e This commit continas:
1. Enable cache if available:
2. The function to prevent in-source builds
2024-09-12 14:25:29 +00:00

13 lines
438 B
CMake

function(AssureOutOfSourceBuilds)
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
if("${srcdir}" STREQUAL "${bindir}")
message("Warning: in-source builds are disabled")
message("Please create a separate build directory and run cmake from there")
message(FATAL_ERROR "Quitting configuration")
endif()
endfunction()
assureOutOfSourceBuilds()