[CMake] FindMPI & policy CMP0004

Andreas Naumann Andreas-Naumann at gmx.net
Sun Mar 11 16:16:18 EDT 2018


Dear all,

recently, I got a problem with FindMPI on our HPC systems. With cmake 
3.10.2, I get an error about policy CMP0004. And I cannot set it to OLD 
anymore. Is this intended?

Exactly the same error, together with a patch, is described in the 
bugtracker https://public.kitware.com/Bug/view.php?id=11881

I cannot reproduce the error easiliy. On my home system, it works. But 
on the hpc system, mpicc -showme:link returns
-L<MPIDIR>/lib -lmpi -ldl -lm -lnuma -Wl,--export-dynamic -lrt -lnsl 
-lutil -lm -ldl

so, we have exactly one -Wl,<something> part and libraries otherwise. It 
looks to me, that the patch from the bugtracker should avoid the problem.
Can somebody confirm this finding?

The problem gets even worse with newercmake versions. With cmake 3.9, I 
can set policy cmp0004 to OLD, so FindMPI remains usable. With newer 
cmake versions, ie. 3.10.2,  the policy setting seems to get deprecated. 
So, the user won't get any way to use newer cmake with such a bug.

What is the preferred way to resolve such an issue, when the policy 
setting is not allowed anymore?

Regards,
Andreas


More information about the CMake mailing list