diff options
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-x | lib/spack/env/cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc index 199ce1d7e6..738a7e37af 100755 --- a/lib/spack/env/cc +++ b/lib/spack/env/cc @@ -382,6 +382,17 @@ case "$mode" in flags=("${flags[@]}" "${SPACK_LDFLAGS[@]}") ;; esac +# On macOS insert headerpad_max_install_names linker flag +if [[ ($mode == ld || $mode == ccld) && "$SPACK_SHORT_SPEC" =~ "darwin" ]]; +then + case "$mode" in + ld) + flags=("${flags[@]}" -headerpad_max_install_names) ;; + ccld) + flags=("${flags[@]}" -Wl,-headerpad_max_install_names) ;; + esac +fi + # Prepend include directories IFS=':' read -ra include_dirs <<< "$SPACK_INCLUDE_DIRS" if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then |