Commit 146b9594 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'environment-modules'

dfea916d FindEnvModules: Provide a CMake interface to environment modules
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3076
parents a9a4f3b1 dfea916d
......@@ -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
......
.. cmake-module:: ../../Modules/FindEnvModules.cmake
environment-modules
-------------------
* The :module:`FindEnvModules` module was added to use Lua- and TCL-based
environment modules in :ref:`CTest Scripts <CTest Script>`.
This diff is collapsed.
......@@ -1421,6 +1421,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindDoxygen)
endif()
if(CMake_TEST_FindEnvModules)
add_subdirectory(FindEnvModules)
endif()
if(CMake_TEST_FindEXPAT)
add_subdirectory(FindEXPAT)
endif()
......
add_test(FindEnvModules.Test ${CMAKE_CMAKE_COMMAND}
-P ${CMAKE_CURRENT_LIST_DIR}/EnvModules.cmake
)
find_package(EnvModules REQUIRED)
message("module purge")
env_module(COMMAND purge RESULT_VARIABLE ret_var)
if(NOT ret_var EQUAL 0)
message(FATAL_ERROR "module(purge) returned ${ret_var}")
endif()
message("module avail")
env_module_avail(avail_mods)
foreach(mod IN LISTS avail_mods)
message(" ${mod}")
endforeach()
if(avail_mods)
list(GET avail_mods 0 mod0)
message("module load ${mod0}")
env_module(load ${mod0})
message("module list")
env_module_list(loaded_mods)
foreach(mod IN LISTS loaded_mods)
message(" ${mod}")
endforeach()
list(LENGTH loaded_mods num_loaded_mods)
message("Number of modules loaded: ${num_loaded_mods}")
if(NOT num_loaded_mods EQUAL 1)
message(FATAL_ERROR "Exactly 1 module should be loaded. Found ${num_loaded_mods}")
endif()
list(GET loaded_mods 0 mod0_actual)
if(NOT (mod0_actual MATCHES "^${mod0}"))
message(FATAL_ERROR "Loaded module does not match ${mod0}. Actual: ${mod0_actual}")
endif()
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment