replace a bash script by a portable cmake