Cray: clean up CrayPrgEnv and CrayLinuxEnvironment modules

CrayPrgEnv:
  - add a new function __cmake_craype_linktype() that determines what
    link mode the Cray compiler wrapper will use in a more sophisticated
    way than just MATCHing for static/dynamic on the command line.

  - add a new function __cmake_craype_setupenv() that does a
    once-per-cmake-run setup that does the following:
       1. does a basic check of the wrapper's configuration.  Running
          cmake and then changing module and/or linktype configuration
          may cause build problems (since the data in the cmake cache
          may no longer be correct after the change).  We look for this
          and warn the user about it.
       2. uses the "module" provided PKG_CONFIG_PATH environment variable
          to add additional prefixes to the system prefix path.  This
          function used to be done by CrayLinuxEnvironment using the
          compiler implicit include/link paths but that is intended
          only for cross-compiling on Cray front-end nodes.  Since
          CrayPrgEnv runs on both front-end and compute nodes, we
          migrate this function here.

CrayLinuxEnvironment:
  - No need to set variables like CMAKE_SHARED_LIBRARY_PREFIX to values
    that have already been properly established by CMakeGenericSystem.cmake.
    Remove redundant sets of CMAKE_SHARED_LIBRARY_PREFIX,
    CMAKE_SHARED_LIBRARY_SUFFIX, CMAKE_STATIC_LIBRARY_PREFIX,
    CMAKE_STATIC_LIBRARY_SUFFIX, CMAKE_FIND_LIBRARY_PREFIXES, and
    CMAKE_DL_LIBS.

  - No need to add $ENV{SYSROOT_DIR}/usr/include to CMAKE_SYSTEM_INCLUDE_PATH
    when we already added $ENV{SYSROOT_DIR}/usr to CMAKE_SYSTEM_PREFIX_PATH.

  - Remove __cray_list_intersect(), __list_clean_dupes(), and buggy
    code that adds compiler implicit includes/libs to
    CMAKE_SYSTEM_INCLUDE_PATH and CMAKE_SYSTEM_LIBRARY_PATH.  This
    function has migrated to CrayPrgEnv.cmake, as noted above.

See discussion in issue #17413 for additional details.
2 files changed