From dfea916d3c1e09d7a008a27029540b5ec77adb5d Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Thu, 7 Mar 2019 15:39:07 -0500 Subject: FindEnvModules: Provide a CMake interface to environment modules --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindEnvModules.rst | 1 + Help/release/dev/environment-modules.rst | 5 + Modules/FindEnvModules.cmake | 333 +++++++++++++++++++++++++++++++ Tests/CMakeLists.txt | 4 + Tests/FindEnvModules/CMakeLists.txt | 3 + Tests/FindEnvModules/EnvModules.cmake | 35 ++++ 7 files changed, 382 insertions(+) create mode 100644 Help/module/FindEnvModules.rst create mode 100644 Help/release/dev/environment-modules.rst create mode 100644 Modules/FindEnvModules.cmake create mode 100644 Tests/FindEnvModules/CMakeLists.txt create mode 100644 Tests/FindEnvModules/EnvModules.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index d9b939f..fc4bfdc 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -125,6 +125,7 @@ They are normally called through the :command:`find_package` command. /module/FindDCMTK /module/FindDevIL /module/FindDoxygen + /module/FindEnvModules /module/FindEXPAT /module/FindFLEX /module/FindFLTK2 diff --git a/Help/module/FindEnvModules.rst b/Help/module/FindEnvModules.rst new file mode 100644 index 0000000..72c120f --- /dev/null +++ b/Help/module/FindEnvModules.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindEnvModules.cmake diff --git a/Help/release/dev/environment-modules.rst b/Help/release/dev/environment-modules.rst new file mode 100644 index 0000000..eace35d --- /dev/null +++ b/Help/release/dev/environment-modules.rst @@ -0,0 +1,5 @@ +environment-modules +------------------- + +* The :module:`FindEnvModules` module was added to use Lua- and TCL-based + environment modules in :ref:`CTest Scripts `. diff --git a/Modules/FindEnvModules.cmake b/Modules/FindEnvModules.cmake new file mode 100644 index 0000000..5d3452d --- /dev/null +++ b/Modules/FindEnvModules.cmake @@ -0,0 +1,333 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindEnvModules +-------------- + +Locate an environment module implementation and make commands available to +CMake scripts to use them. This is compatible with both Lua-based Lmod +and TCL-based EnvironmentModules. + +This module is intended for the use case of setting up the compiler and library +environment within a :ref:`CTest Script ` (``ctest -S``). It can +also be used in a :ref:`CMake Script