diff --git a/CMakeLists.txt b/CMakeLists.txt index 26cb090..60de236 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,18 +5,20 @@ project(static-subid C) # ############################################################################## # CMake modules include(GNUInstallDirs) +include(CheckCSourceCompiles) include(CheckCCompilerFlag) enable_testing() # ############################################################################## # Require out-of-source builds -file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH) -if(EXISTS "${LOC_PATH}") - message( - FATAL_ERROR - "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory and run cmake from there." - ) -endif(EXISTS "${LOC_PATH}") +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message(FATAL_ERROR + "In-source builds are not allowed.\n" + "Create a separate build directory and run cmake from there:\n" + " mkdir build && cd build && cmake ..\n" + "Remove CMakeCache.txt and CMakeFiles/ if they were created here." + ) +endif() # ############################################################################## # Compiler Sanity Test diff --git a/static-subid.spec b/static-subid.spec index 407e8c3..126afd2 100644 --- a/static-subid.spec +++ b/static-subid.spec @@ -19,7 +19,7 @@ Suggests: %{name}-systemd Requires: shadow-utils Summary: Assign deterministic subordinate UID/GID ranges %description -static-subuid is a small utility to generate predictable subordinate UID and GID ranges for Linux users, avoiding the default dynamic allocation behavior used by many systems. +static-subid is a small utility to generate predictable subordinate UID and GID ranges for Linux users, avoiding the default dynamic allocation behavior used by many systems. This can be useful when you need consistent UID/GID mappings across multiple systems (for example in identity-mapped rootless containers or reproducible user namespace setups).