File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,26 @@ if(DEFINED ENV{KML_ROOT})
7474endif ()
7575list (APPEND _kml_prefix_hints /usr/local/kml)
7676
77+ # Check if an explicitly selected compiler-specific KML prefix matches the compiler.
78+ set (_kml_explicit_root "${KML_ROOT} " )
79+ if (NOT _kml_explicit_root AND DEFINED ENV{KML_ROOT})
80+ set (_kml_explicit_root "$ENV{KML_ROOT} " )
81+ endif ()
82+ get_filename_component (_kml_root_name "${_kml_explicit_root} " NAME )
83+ if (_kml_root_name STREQUAL "gcc" )
84+ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
85+ message (FATAL_ERROR
86+ "KML_ROOT points to the GCC KML bundle, but the C++ compiler is "
87+ "${CMAKE_CXX_COMPILER_ID } ." )
88+ endif ()
89+ elseif (_kml_root_name STREQUAL "bisheng" )
90+ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
91+ message (FATAL_ERROR
92+ "KML_ROOT points to the BiShengLLVM KML bundle, but the C++ compiler is "
93+ "${CMAKE_CXX_COMPILER_ID } ." )
94+ endif ()
95+ endif ()
96+
7797find_path (KML_INCLUDE_DIR
7898 NAMES kblas.h klapack.h kscalapack.h
7999 HINTS ${_kml_prefix_hints}
You can’t perform that action at this time.
0 commit comments