jedbrown / cmake-modules

CMake modules for some scientific libraries
BSD 2-Clause "Simplified" License
87 stars 54 forks source link

FindPETSc: failure on PETSC_ARCH with ^ character #36

Open nwukie opened 5 years ago

nwukie commented 5 years ago

I have a petsc build on OSX with PETSC_ARCH=gcc-9.2.0^openmpi-3.1.1. The '^' character in the folder name seems to cause a call to echo in ${petsc_config_makefile} return bad data. Investigating a little more, it seems the behavior of 'echo' is notoriously non-portable, especially when used with flags and variables that contain dashes.

Problem in FindPETSc.cmake Line 159: \t-@echo -n \${\${VARIABLE}}

Proposed solution: \t-@printf '%s' \${\${VARIABLE}}

The proposed solution solves my build error, I just wasn't sure if it would cause any issues with other build configurations.

jedbrown commented 5 years ago

I think this solution is good. Would you be willing to make a pull request to make this change?