summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-24 23:02:59 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-25 08:27:46 -0700
commit839c3c83993b2b8d9d6be20407afdf59be23e701 (patch)
treebfc896e886dcee25955af8db3ed455f8e598f2bb /CMakeLists.txt
parent1ff1f0e3c26e40a92d56630a092d65fac9655b64 (diff)
libcr: Add very basic tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bffff9..4082d53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,35 @@ function(add_lib_test arg_libname arg_testname)
endif()
endfunction()
+function(_apply_matrix_helper _m_depth _m_assignments)
+ list(LENGTH _m_arg_matrix _m_dimensions)
+ math(EXPR _m_dimensions ${_m_dimensions}/2)
+ if("${_m_depth}" EQUAL "${_m_dimensions}")
+ cmake_language(CALL "${_m_arg_action}" "${_m_n}" "${_m_assignments}")
+ math(EXPR _m_n "${_m_n}+1")
+ set(_m_n "${_m_n}" PARENT_SCOPE)
+ else()
+ math(EXPR _m_ik "${_m_depth}*2")
+ list(GET _m_arg_matrix "${_m_ik}" _m_tmp_key)
+
+ math(EXPR _m_iv "${_m_ik}+1")
+ list(GET _m_arg_matrix "${_m_iv}" _m_tmp_vals)
+ string(REGEX REPLACE "^\\[(.*)\\]$" "\\1" _m_tmp_vals "${_m_tmp_vals}")
+
+ foreach(_m_tmp_val IN LISTS _m_tmp_vals)
+ math(EXPR _m_tmp_depth "${_m_depth}+1")
+ set(_m_tmp_assignments "${_m_assignments}")
+ list(APPEND _m_tmp_assignments "${_m_tmp_key}=${_m_tmp_val}")
+ _apply_matrix_helper("${_m_tmp_depth}" "${_m_tmp_assignments}")
+ set(_m_n "${_m_n}" PARENT_SCOPE)
+ endforeach()
+ endif()
+endfunction()
+function(apply_matrix _m_arg_action _m_arg_matrix)
+ set(_m_n 0)
+ _apply_matrix_helper(0 "")
+endfunction()
+
add_subdirectory(libmisc)
add_subdirectory(libcr)
add_subdirectory(libcr_ipc)