[llvm] [orc-rt] Refactor CMakeLists.txt for readability. NFCI. (PR #208156)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 00:13:57 PDT 2026
https://github.com/lhames created https://github.com/llvm/llvm-project/pull/208156
Groups related options, adds comments and separators.
>From 9c4c9ed5dbde593d7d48ee5971a3b2c4c622700e Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Wed, 8 Jul 2026 17:10:18 +1000
Subject: [PATCH] [orc-rt] Refactor CMakeLists.txt for readability. NFCI.
Groups related options, adds comments and separators.
---
orc-rt/CMakeLists.txt | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt
index 945199e1ea219..c3d06f6ede4bd 100644
--- a/orc-rt/CMakeLists.txt
+++ b/orc-rt/CMakeLists.txt
@@ -33,23 +33,20 @@ include(GNUInstallDirs)
# Setup CMake Options
#===============================================================================
+# --- Build components ---
option(ORC_RT_INCLUDE_DOCS "Build the ORC-RT documentation." ON)
+option(ORC_RT_INCLUDE_TESTS "Build ORC-RT tests." ${LLVM_INCLUDE_TESTS})
+
+# --- Build behavior ---
option(ORC_RT_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(ORC_RT_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(ORC_RT_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
+
+# --- Language runtime (RTTI / exceptions) ---
option(ORC_RT_ENABLE_RTTI "Enable RTTI." ON)
option(ORC_RT_ENABLE_EXCEPTIONS "Enable exceptions." ON)
-option(ORC_RT_INCLUDE_TESTS "Build ORC-RT tests." ${LLVM_INCLUDE_TESTS})
-
-set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
-set(CMAKE_CXX_STANDARD_REQUIRED YES)
-set(CMAKE_CXX_EXTENSIONS NO)
-set(CMAKE_FOLDER "orc-rt")
-
-set(ORC_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(ORC_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-# Configure RTTI and exceptions compile flags
+# Derive the compile flags implied by the language-runtime options.
set(ORC_RT_COMPILE_FLAGS)
if(ORC_RT_ENABLE_RTTI)
list(APPEND ORC_RT_COMPILE_FLAGS -frtti)
@@ -63,7 +60,18 @@ else()
list(APPEND ORC_RT_COMPILE_FLAGS -fno-exceptions)
endif()
-# Generate config header
+# --- C++ standard ---
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+set(CMAKE_CXX_EXTENSIONS NO)
+
+# --- Project variables ---
+set(CMAKE_FOLDER "orc-rt")
+set(ORC_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(ORC_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+# --- Generated config header ---
+# Keep this last in the section so it captures every value derived above.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/orc-rt-c/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/orc-rt-c/config.h
More information about the llvm-commits
mailing list