feature: add `EXPECTED_BINARY_DIR` argument to `project` command
CMake tooling often requires binary dir to be "${CMAKE_SOURCE_DIR}/build"
I suggest adding EXPECTED_BINARY_DIR
to emit fatal error if binary dir doesn't match a specified pattern.
Currently:
https://github.com/skyrim-multiplayer/skymp/blob/main/CMakeLists.txt#L34
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}/build")
set(msg "CMake binary directory must be <repo_root>/build")
set(msg "${msg}\nUse commands below after cloning the repo (replace path with your actual Skyrim SE folder):")
set(msg "${msg}\n mkdir build")
set(msg "${msg}\n cd build")
set(msg "${msg}\nFor users who have Skyrim SE installed:")
set(msg "${msg}\n cmake .. -DSKYRIM_DIR=\"C:/Program Files (x86)/Steam/steamapps/common/Skyrim Special Edition\"")
set(msg "${msg}\nFor users who don't have Skyrim SE installed:")
set(msg "${msg}\n cmake ..")
message(FATAL_ERROR "${msg}")
endif()
cmake_minimum_required(VERSION 3.18.2)
project(skymp)
With the feature implemented:
project(skymp EXPECTED_BINARY_DIR build)
- CMAKE_SOURCE_DIR would be used as a base path for relative paths
- Regex would be allowed
Please leave a feedback for this feature request.