Enable CXX only when needed for tests/benchmarks
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f71fbfd..b5db1a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@
 # ---[ Setup project
 PROJECT(
     cpuinfo
-    LANGUAGES C CXX
+    LANGUAGES C
     )
 
 # ---[ Options.
@@ -114,6 +114,12 @@
   ENDIF()
 ENDIF()
 
+IF(CPUINFO_SUPPORTED_PLATFORM)
+  IF(CPUINFO_BUILD_MOCK_TESTS OR CPUINFO_BUILD_UNIT_TESTS OR CPUINFO_BUILD_BENCHMARKS)
+    ENABLE_LANGUAGE(CXX)
+  ENDIF()
+ENDIF()
+
 # ---[ Download deps
 SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps
   CACHE PATH "Confu-style dependencies source directory")