Skip to content

Commit

Permalink
CMake: don't enable CXX unless building tests/benchmarks
Browse files Browse the repository at this point in the history
We only need CXX support when building tests/benchmarks.

Fixes:
CMake Error at CMakeLists.txt:6 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

Signed-off-by: James Hilliard <[email protected]>
  • Loading branch information
jameshilliard authored and Maratyszcza committed May 28, 2024
1 parent f0bd4b9 commit db33f23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR)

# ---[ Project
PROJECT(FP16 C CXX)
PROJECT(FP16 C)

# ---[ Options.
OPTION(FP16_BUILD_TESTS "Build FP16 unit tests" ON)
OPTION(FP16_BUILD_BENCHMARKS "Build FP16 micro-benchmarks" ON)
OPTION(FP16_BUILD_COMPARATIVE_BENCHMARKS "Build FP16 micro-benchmarks comparing to alternatives" OFF)

# ---[ CMake options
IF(FP16_BUILD_TESTS OR FP16_BUILD_BENCHMARKS)
ENABLE_LANGUAGE(CXX)
ENDIF()

IF(FP16_BUILD_TESTS)
ENABLE_TESTING()
ENDIF()
Expand Down

0 comments on commit db33f23

Please sign in to comment.