Skip to content

Find{BLAS,LAPACK}: Handle Intel compiler MKLROOT on Windows

scivision requested to merge scivision/cmake:intelwin into master

Solution suggested by Marc Chevrier

before this fix, CMake crashes with Intel compiler on Windows because MKLROOT from Intel has backslashes:

find_package(BLAS)

or

find_package(LAPACK)

I think this is a long-standing issue, not from a recent code change. These are the only two Find*.cmake scripts using MKLROOT.

traceback

traceback is the same on Cmake 3.16, 3.18 and probably many older versions:

CMake Error at C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136 (set):
  Syntax error in cmake code at

    C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136

  when parsing string

    C:\Program Files (x86)\inteloneapi\mkl\latest/lib/intel64_win

  Invalid character escape '\P'.
Call Stack (most recent call first):
  C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:427 (check_fortran_libraries)
  CMakeLists.txt:30 (find_package)

Backport: release
Topic-rename: find-blas-lapack-mklroot-win

Edited by Brad King

Merge request reports