cmake include path containing special character
Summary:
cmake is failing to compile a commercial library (https://my.st.com/content/my_st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stm32-cryp-lib.html) and that the include path is included as a header from within that library.
Environment:
cmake version 3.16.4 using -G "Unix Makefiles" option.
cmake --build .
produces error: **make[2]: *** No rule to make target 'Kernel/platform/STMLib/STM32_Crypto_AccHw/Inc/RSA/PKCS', needed by **
The error is because cmake is not considering full include path ( containing # character )
The complete include path is: ../Kernel/platform/STMLib/STM32_Crypto_AccHw/Inc/RSA/PKCS**#**1v15/AccHw_rsa_pkcs1v15.h
Looking closely at depend.make ( autogenerated by unixMakefile generator ):
<..>/CMakeFiles/Kernel.dir/src/test.c.obj: ../Kernel/platform/STMLib/STM32_Crypto_AccHw/Inc/RSA/PKCS**#**1v15/AccHw_rsa_pkcs1v15.h
Please note special character (#) in the above line.
When cmake parses above include path from depend.make, following error is observed on the command-line.
**make[2]: *** No rule to make target 'Kernel/platform/STMLib/STM32_Crypto_AccHw/Inc/RSA/PKCS', needed by **
Cmake clearly stops at the point where it meets with special character # in include path.
Just to make sure the issue is coming form depned.make, following test was performed by manually replacing # with # in depend.make file <..>/CMakeFiles/Kernel.dir/src/test.c.obj: ../Kernel/platform/STMLib/STM32_Crypto_AccHw/Inc/RSA/PKCS#1v15/AccHw_rsa_pkcs1v15.h
and then simply called cmake --build .
With above change( replacing # with # in depend.make ) the compilation worked just fine!
In conclusion, CMAKE must take care of special characters in the include paths.
Any help on this topic will be great. Please don't hesitate to contact , should you require any other info regarding this issue.