Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ macro(tribits_setup_compiler_flags PACKAGE_NAME_IN)

assert_defined(PARSE_CLEANED)

assert_defined(${PROJECT_NAME}_ENABLE_C ${PROJECT_NAME}_ENABLE_C_DEBUG_COMPILE_FLAGS)
assert_defined(${PROJECT_NAME}_ENABLE_C)
if (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_C_COMPILE_WARNINGS)
tribits_apply_warnings_as_error_flags_lang(C)
endif()

assert_defined(${PROJECT_NAME}_ENABLE_CXX ${PROJECT_NAME}_ENABLE_CXX_DEBUG_COMPILE_FLAGS)
assert_defined(${PROJECT_NAME}_ENABLE_CXX)
if (PARSE_CLEANED AND ${PROJECT_NAME}_ENABLE_STRONG_CXX_COMPILE_WARNINGS)
tribits_apply_warnings_as_error_flags_lang(CXX)
endif()
Expand Down
12 changes: 4 additions & 8 deletions cmake/tribits/core/utils/AssertDefined.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

# @FUNCTION: assert_defined()
#
# Assert that a variable is defined and if not call ``message(SEND_ERROR
# Assert that one or more variables are defined and if not call ``message(SEND_ERROR
# ...)``.
#
# Usage::
#
# assert_defined(<varName>)
# assert_defined(<varName1> [, <varName2>, ...])
#
# This is used to get around the problem of CMake not asserting the
# dereferencing of undefined variables. For example, how does one know if one
Expand Down Expand Up @@ -43,14 +43,10 @@
# same. This is the best that can be done in CMake unfortunately to catch
# usage of misspelled undefined variables.
#
function(assert_defined VARS)
foreach(VAR ${VARS})
function(assert_defined)
foreach(VAR ${ARGV})
if(NOT DEFINED ${VAR})
message(SEND_ERROR "Error, the variable ${VAR} is not defined!")
endif()
endforeach()
endfunction()

# ToDo: The VARS arg This really needs to be replaced with ${ARGV}. I fear
# that only the first arg passed in is asserted. However, to change this now
# is breaking backward compatibility.
Loading