CADET Compilation on Windows Error "Invalid character escape '\P'."

Start situation

While trying to set up updated build instructions on Windows 10-11 I’ve run into this error message while following this guide:

CMake Error at cmake/Modules/FindBLAS.cmake:174 (set):
  Syntax error in cmake code at


  when parsing string

    C:\Program Files (x86)\Intel\oneAPI\mkl\latest

  Invalid character escape '\P'.		C:\Users\ron\Documents\CADET-master\cmake/Modules/FindBLAS.cmake	174

Update 1:

I’ve found that the culprit is the environment variable MKLROOT. Changing it to

MKLROOT=C:\\Program Files (x86)\\Intel\\oneAPI\\mkl\\latest

seems to solve the problem. However, that can’t be done in the user env variables, because it gets overwritten by VisualStudio, due to the Intel oneAPI integration.

1 Like

Update 2

It now crashes, because it looks for “hdf5.lib” but vcpkg installs “libhdf5.lib”. Any suggestions from the C-crowd on how to solve this besides renaming the file?

Hey Ron, I use Windows to compile CADET and haven’t encountered many issues so far.

For the MKL, make sure to use the latest version from oneAPI website, the directory for these lib files is sometimes changed between different versions. I updated mine in Aug this year. Below is how I set my MKL root in VS 2019 command:

set MKLROOT=C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64

Inside this fold you can find all these libs:

For the HDF5, it’s downloaded from the HDF5 group (as mentioned in the instructions). After building it you should see both hdf5.lib and libhdf5.lib:

I use:
to set up the path.


Hey Flynn,

thank you for your help!

For context: I’m trying to simplify the build instructions as far as possible, and that includes removing as many custom dependency compilations as possible. Part of that is that I’m trying to install the HDF5 library with vcpkg, which comes shipped with VisualStudio2022, and that’s where I’m running into the filename error.

Update 3:

Using the vcpkg that comes bundled with VisualStudio 2022, a vcpkg “manifest” file (which functions like a conda environment.yml) and setting the -DCMAKE_TOOLCHAIN_FILE to point to VS’s vcpkg, it all works. Will create a write up and PR soon.


Update 4:

After placing these files:

vcpkg.json (73 Bytes)
vcpkg-configuration.json (348 Bytes)

in the cadet code directory. Now this command

cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_INSTALL_PREFIX=..\cadet -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" ..\code\ --fresh

msbuild.exe INSTALL.vcxproj /p:Configuration=Release;Platform=x64

works, but does not link any of the dependencies. All dependency dlls will need to be manually copied to the cadet-cli folder. Run cadet-cli.exe from the explorer to have it print out which dependencies are missing.

cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX=..\cadet -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake"  ..\code\ --fresh 

msbuild.exe INSTALL.vcxproj /p:Configuration=Release;Platform=x64

should build statically linked deps but crashes because it can not find symbols from the metis library. Will talk to Sam about this tomorrow.

1 Like

Final update (for now)

We have working and simplified build instructions for Windows. They can be found at

and will be merged into the main branch hopefully soon.

Do note, that these build instructions are based on the code in that branch. They will not work with the master branch.


Hi Ronald,

Thank you for spending time on this!

I have tried to follow the instructions and downloaded the repository from the branch.
However, in the msbuild.exe INSTALL.vcxproj /p:Configuration="Release;Platform=x64" step, I run into errors. The same errors occur both when I run it in Developer PowerShell and Developer Command Prompt. The errors are:

Most of the warnings are from saying “unreferenced formal parameter”.
Hence, the install folder is completely empty.


Hey Jesper,
are you trying to build and use the Matlab interface? Because the errors are from cadet-mex.cpp.

If you do need Matlab, we’ll have to set up a call, because I don’t have matlab and couldn’t test for Matlab.
If you don’t need Matlab, try setting the build variable -DENABLE_CADET_MEX=OFF so that CADET_MEX isn’t build.

Best wishes,

1 Like

Hi Ron,

Indeed I have Matlab installed, though I dont want to incorporate it with CADET.
it worked when I included "

cmake -DCMAKE_INSTALL_PREFIX="..\install" -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$ENV:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DENABLE_STATIC_LINK_LAPACK=ON -DENABLE_STATIC_LINK_DEPS=ON -DBLA_VENDOR=Intel10_64lp_seq "..\code\" --fresh -DENABLE_CADET_MEX=OFF

Thank you very much!