Debian Codegraph @

testsuite/bin/install_test_cmake

raw
1 #
2 # INSTALL_TEST_CMAKE, cmake test script for install non-reg suite
3 # Copyright (C) 2017-2021 Xavier Delaruelle
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 ##########################################################################
19
20 cmake_policy(SET CMP0007 NEW)
21
22 if(NOT EXISTS ${initfile})
23 message(FATAL_ERROR "Cannot read ${initfile}")
24 endif()
25
26 # source module init file
27 include(${initfile})
28
29 # execute command list
30 set(code 0)
31 set(func "module")
32 string(REPLACE ":" ";" cmdsplit "${cmdlist}")
33 # empty command list, means one empty command
34 list (LENGTH cmdlist cmdcnt)
35 if(${cmdcnt} EQUAL 0)
36 module("")
37 else()
38 foreach(cmd ${cmdsplit})
39 # call ml procedure instead of module
40 if("${cmd}" STREQUAL "ml")
41 set(func "ml")
42 else()
43 set(quotedArgs "")
44 # if command equals to NOARG string, means call with no arg passed
45 if(NOT "${cmd}" STREQUAL "NOARG")
46 string(REPLACE "," ";" cmdelt "${cmd}")
47 list (LENGTH cmdelt eltcnt)
48 # empty arg list, means one empty arg
49 if (${eltcnt} EQUAL 0)
50 string(APPEND quotedArgs "\"\"")
51 else()
52 foreach(elt IN LISTS cmdelt)
53 if(NOT "${quotedArgs}" STREQUAL "")
54 string(APPEND quotedArgs " ")
55 endif()
56 string(APPEND quotedArgs "[===[${elt}]===]")
57 endforeach()
58 endif()
59 endif()
60 cmake_language(EVAL CODE "${func}(${quotedArgs})")
61 endif()
62 if(NOT module_result AND NOT ${module_result} STREQUAL "")
63 set(code 1)
64 elseif(NOT ${module_result} STREQUAL "TRUE")
65 message(STATUS ${module_result})
66 endif()
67 endforeach()
68 endif()
69
70 if(${code})
71 message(FATAL_ERROR "")
72 endif()
73 # vim:set tabstop=3 shiftwidth=3 expandtab autoindent: