cmake: Add support for builtin codegen target

Additionally, this change removes unnecessary braces in the `if()`
command for improved robustness, readability and consistency with CMake
guidelines.
This commit is contained in:
Hennadii Stepanov committed 2025-02-21 11:11:30 +00:00
1 parent a8c78a0574
commit ecf54a32ed
2 files changed
+17 -1

No files matched your search

+7 -1
View File
@@ -9,10 +9,16 @@
# - CMake 3.26.5, https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/
cmake_minimum_required(VERSION 3.22)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
if(POLICY CMP0171)
# `codegen` is a reserved target name.
# See: https://cmake.org/cmake/help/latest/policy/CMP0171.html
cmake_policy(SET CMP0171 NEW)
endif()
#=============================
# Project / Package metadata
#=============================