File: expecting.cmake

package info (click to toggle)
ecbuild 3.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,068 kB
  • sloc: sh: 1,404; perl: 732; f90: 472; cpp: 466; python: 383; ansic: 304; fortran: 43; makefile: 15
file content (58 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

function( expecting_true )

    set( options )
    set( single_value_args CONDITION )
    set( multi_value_args )
    cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )

    ecbuild_debug( "Checking if true: ${_p_CONDITION}=${${_p_CONDITION}}" )
    if ( NOT ${${_p_CONDITION}} )
        ecbuild_critical( "Expected condition ${_p_CONDITION} to be true" )
    endif()

endfunction()

function( expecting_false )

    set( options )
    set( single_value_args CONDITION )
    set( multi_value_args )
    cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )

    ecbuild_debug( "Checking if true: ${_p_CONDITION}=${${_p_CONDITION}}" )
    if ( ${${_p_CONDITION}} )
        ecbuild_critical( "Expected condition ${_p_CONDITION} to be false" )
    endif()

endfunction()


function( expecting_empty )

    set( options )
    set( single_value_args CONDITION )
    set( multi_value_args )
    cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )

    ecbuild_debug( "Checking if nonempty: ${_p_CONDITION}=${${_p_CONDITION}}" )
    if ( NOT "${${_p_CONDITION}}" STREQUAL "" )
        ecbuild_critical( "Expected condition ${_p_CONDITION} to be a non-empty string" )
    endif()

endfunction()


function( expecting_nonempty )

    set( options )
    set( single_value_args CONDITION )
    set( multi_value_args )
    cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )

    ecbuild_debug( "Checking if nonempty: ${_p_CONDITION}=${${_p_CONDITION}}" )
    if ( "${${_p_CONDITION}}" STREQUAL "" )
        ecbuild_critical( "Expected condition ${_p_CONDITION} to be a non-empty string" )
    endif()

endfunction()