You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmake: document options and set defaults for influential variables
Add documentation strings and defaults for CMake cache variables
including TARGET, BINARY, threading options, vector extensions, memory
tuning, and precision types. Treat empty string values as "not set" to
allow auto-detection while keeping options visible in ccmake.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
# Handle cache options that should be auto-detected if empty
38
+
# We keep the cache entry visible in ccmake but treat empty values as "not set"
39
+
set(_TARGET_SET FALSE)
40
+
if (DEFINEDTARGETANDNOT"${TARGET}"STREQUAL"")
41
+
set(_TARGET_SET TRUE)
42
+
endif()
43
+
44
+
if(CMAKE_CROSSCOMPILINGANDNOT _TARGET_SET)
38
45
# Detect target without running getarch
39
46
if (ARM64)
40
47
set(TARGET"ARMV8")
48
+
set(_TARGET_SET TRUE)
41
49
elseif(ARM)
42
50
set(TARGET"ARMV7") # TODO: Ask compiler which arch this is
51
+
set(_TARGET_SET TRUE)
43
52
else()
44
53
message(FATAL_ERROR "When cross compiling, a TARGET is required.")
45
54
endif()
46
55
endif()
47
56
57
+
set(_BINARY_SET FALSE)
58
+
if (DEFINED BINARY ANDNOT"${BINARY}"STREQUAL"")
59
+
set(_BINARY_SET TRUE)
60
+
endif()
61
+
62
+
set(_USE_THREAD_SET FALSE)
63
+
if (DEFINED USE_THREAD ANDNOT"${USE_THREAD}"STREQUAL"")
64
+
set(_USE_THREAD_SET TRUE)
65
+
endif()
66
+
67
+
set(_NUM_THREADS_SET FALSE)
68
+
if (DEFINED NUM_THREADS ANDNOT"${NUM_THREADS}"STREQUAL"")
69
+
set(_NUM_THREADS_SET TRUE)
70
+
endif()
71
+
48
72
# Other files expect CORE, which is actually TARGET and will become TARGET_CORE for kernel build. Confused yet?
49
73
# It seems we are meant to use TARGET as input and CORE internally as kernel.
50
-
if(NOTDEFINED CORE ANDDEFINEDTARGET)
74
+
if(NOTDEFINED CORE AND_TARGET_SET)
51
75
if (${TARGET}STREQUAL"LOONGSON3R5")
52
76
set(CORE "LA464")
53
77
elseif (${TARGET}STREQUAL"LOONGSON2K1000")
@@ -65,7 +89,7 @@ if (DEFINED TARGET_CORE)
65
89
endif ()
66
90
67
91
# Force fallbacks for 32bit
68
-
if (DEFINED BINARY ANDDEFINEDTARGETAND BINARY EQUAL 32)
92
+
if (_BINARY_SET AND_TARGET_SETAND BINARY EQUAL 32)
69
93
message(STATUS"Compiling a ${BINARY}-bit binary.")
70
94
set(NO_AVX 1)
71
95
if (${TARGET}STREQUAL"HASWELL"OR${TARGET}STREQUAL"SANDYBRIDGE"OR${TARGET}STREQUAL"SKYLAKEX"OR${TARGET}STREQUAL"COOPERLAKE"OR${TARGET}STREQUAL"SAPPHIRERAPIDS")
@@ -83,7 +107,7 @@ if (DEFINED BINARY AND DEFINED TARGET AND BINARY EQUAL 32)
0 commit comments