Improve CMake-in-tree fatal error message

This commit is contained in:
ISSOtm
2026-03-14 16:56:54 -04:00
committed by Rangi
parent bc37b0ece6
commit 275fcf8fcf

View File

@@ -10,15 +10,12 @@ project(rgbds
include(CTest) include(CTest)
# get real path of source and binary directories # Reject in-source builds, as they may conflict with the Makefile.
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
# reject in-source builds, may conflict with Makefile
if(srcdir STREQUAL bindir) if(srcdir STREQUAL bindir)
message("RGBDS should not be built in the source directory.") message(FATAL_ERROR "RGBDS should not be built in the source directory.
message("Instead, create a separate build directory and specify to CMake the path to the source directory.") Instead, create a separate build directory and specify to CMake the path to the source directory.")
message(FATAL_ERROR "Terminating configuration")
endif() endif()
include(CMakeDependentOption) include(CMakeDependentOption)