Build mock library with CMake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b1f012..e76e347 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,21 @@
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+# ---[ cpuinfo mock library
+IF(BUILD_MOCK_TESTS)
+ SET(CPUINFO_MOCK_SRCS "${CPUINFO_SRCS}")
+ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
+ LIST(APPEND CPUINFO_MOCK_SRCS src/linux/mockfile.c)
+ ENDIF()
+
+ ADD_LIBRARY(cpuinfo_mock ${CPUINFO_MOCK_SRCS})
+ SET_TARGET_PROPERTIES(cpuinfo_mock PROPERTIES VERSION ${PROJECT_VERSION})
+ SET_TARGET_PROPERTIES(cpuinfo_mock PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
+ TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PRIVATE include)
+ TARGET_INCLUDE_DIRECTORIES(cpuinfo_mock PRIVATE src)
+ TARGET_COMPILE_DEFINITIONS(cpuinfo_mock PRIVATE "-DCPUINFO_MOCK=1")
+ENDIF()
+
# ---[ Helper and debug tools
IF(BUILD_TOOLS)
ADD_EXECUTABLE(isa-info tools/isa-info.c)