I have a CMake Project where I specify to find the include dirs using
target_include_directories (project PUBLIC ${MPI_C_INCLUDE_DIRS})
The following message results in an empty output if I set -DCMAKE_C_COMPILER=/path/to/mpicc
message(STATUS "MPI Include directories : ${MPI_C_INCLUDE_DIRS}")
but results in the correct directory if the compiler is set to gcc
-DCMAKE_C_COMPILER=/path/to/gcc
Any advice will be really helpful. The behavior is reproduced on cmake 3.22 on windows subsystem for linux and also on fedora.