mirror of
https://github.com/fltk/fltk.git
synced 2025-12-11 05:31:07 +08:00
Disallow in-source builds
Rationale: 1. Building in-source creates a lot of untracked files in the source tree. We need to take care not to commit any of them, hence we have to maintain .gitignore files in several directories. 2. Tests reveal that there are even files in git that are modified in the source tree when building docs etc. which means e.g. that builds can't be "repeated" after upgrading the sources, and that those files could be committed by accident. To avoid this we'd have to reorganize the build procedure and make it even more complex rather than simplifying it. 3. With autoconf/configure/make we didn't have a choice, i.e. we had to allow in-source builds with configure/Makefiles anyway. This is no longer true since we removed configure/make support. Note, todo: if this commit doesn't introduce unexpected issues, then we can remove a lot of stuff from the .gitignore files, but this is left for a later commit.
This commit is contained in:
@@ -15,6 +15,23 @@
|
||||
# https://www.fltk.org/bugs.php
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# Prevent building in the source tree - don't pollute the sources
|
||||
#######################################################################
|
||||
|
||||
if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
||||
message("")
|
||||
message(STATUS "=======================================================================")
|
||||
message(STATUS " NOTE: In-source builds of FLTK are disabled to prevent writing to the")
|
||||
message(STATUS " NOTE: source tree. Please create a subfolder (e.g. 'build') and use")
|
||||
message(STATUS " NOTE: `cmake ..` inside it or use for instance `cmake . -B build`.")
|
||||
message(STATUS " NOTE: CMake will, however, create CMakeCache.txt and CMakeFiles/* .")
|
||||
message(STATUS " NOTE: You must delete CMakeCache.txt and CMakeFiles/* manually.")
|
||||
message(STATUS "=======================================================================")
|
||||
message("")
|
||||
message(FATAL_ERROR "*** In-source builds are disabled, please read notes above! ***")
|
||||
endif()
|
||||
|
||||
#######################################################################
|
||||
# Set CMake minimum version first: must be set before `project()`
|
||||
#######################################################################
|
||||
|
||||
Reference in New Issue
Block a user