Permalink
Browse files

COMP: Fix macro SlicerMacroConfigureGeneric{Cxx, Python}ModuleTests s…

…anity checks

Commit r21871 fixed the sanity check associated with macro
"SlicerMacroConfigureGenericCxxModuleTests" by testing the content of
the variable.

This approach works well for function. In case of macro, only parameter
referenced using ${argX} are replaced. It means the following code
doesn't work:

// ----------
macro(foo bar)
  set(var "foo")
  message("${var}:${${var}}")
endmacro()

foo("hello")
// ----------

It outputs:

  foo:

whereas the following is expected:

  foo:hello

This commit fix the problem by explicitly testing the parameter value.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21873 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
1 parent eaa7a17 commit f76ce3d1b3444a3ab053b4aa88c8fff2c5588976 @jcfr jcfr committed Apr 5, 2013
View
21 CMake/SlicerMacroConfigureGenericCxxModuleTests.cmake
@@ -5,12 +5,21 @@
macro(SlicerMacroConfigureGenericCxxModuleTests MODULENAMES TEST_SRCS_OUTPUT_VAR TEST_NAMES_OUTPUT_VAR TEST_NAMES_CXX_OUTPUT_VAR)
# Sanity checks
- set(expected_nonempty_vars MODULENAMES TEST_SRCS_OUTPUT_VAR TEST_NAMES_OUTPUT_VAR TEST_NAMES_CXX_OUTPUT_VAR Slicer_CXX_MODULE_TEST_TEMPLATES_DIR)
- foreach(var ${expected_nonempty_vars})
- if("${${var}}" STREQUAL "")
- message(FATAL_ERROR "error: Variable ${var} is empty !")
- endif()
- endforeach()
+ if("${MODULENAMES}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable MODULENAMES is empty !")
+ endif()
+ if("${TEST_SRCS_OUTPUT_VAR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable TEST_SRCS_OUTPUT_VAR is empty !")
+ endif()
+ if("${TEST_NAMES_OUTPUT_VAR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable TEST_NAMES_OUTPUT_VAR is empty !")
+ endif()
+ if("${TEST_NAMES_CXX_OUTPUT_VAR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable TEST_NAMES_CXX_OUTPUT_VAR is empty !")
+ endif()
+ if("${Slicer_CXX_MODULE_TEST_TEMPLATES_DIR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable Slicer_CXX_MODULE_TEST_TEMPLATES_DIR is empty !")
+ endif()
set(MODULEPATH_WITHOUT_INTDIR ${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_BIN_DIR})
View
15 CMake/SlicerMacroConfigureGenericPythonModuleTests.cmake
@@ -5,12 +5,15 @@
macro(SlicerMacroConfigureGenericPythonModuleTests MODULENAMES TEST_SCRIPTS_OUTPUT_VAR)
# Sanity checks
- set(expected_nonempty_vars MODULENAMES TEST_SCRIPTS_OUTPUT_VAR Slicer_PYTHON_MODULE_TEST_TEMPLATES_DIR)
- foreach(var ${expected_nonempty_vars})
- if("${var}" STREQUAL "")
- message(FATAL_ERROR "error: Variable ${var} is empty !")
- endif()
- endforeach()
+ if("${MODULENAMES}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable MODULENAMES is empty !")
+ endif()
+ if("${TEST_SCRIPTS_OUTPUT_VAR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable TEST_SCRIPTS_OUTPUT_VAR is empty !")
+ endif()
+ if("${Slicer_PYTHON_MODULE_TEST_TEMPLATES_DIR}" STREQUAL "")
+ message(FATAL_ERROR "error: Variable Slicer_PYTHON_MODULE_TEST_TEMPLATES_DIR is empty !")
+ endif()
foreach(MODULENAME ${MODULENAMES})

0 comments on commit f76ce3d

Please sign in to comment.