From 0efa63fdfc742e68bca3ec0eee75fbe396bbf1ae Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Fri, 22 Dec 2023 14:12:13 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Zachery Crandall --- .../dependencies/impl_/check_optional_flag.cmake | 11 +++++------ .../dependencies/impl_/test_check_optional_flag.cmake | 7 +++++++ .../dependencies/test_find_optional_dependency.cmake | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmake/cmaize/user_api/dependencies/impl_/check_optional_flag.cmake b/cmake/cmaize/user_api/dependencies/impl_/check_optional_flag.cmake index e7ef767f..b885e6b8 100644 --- a/cmake/cmaize/user_api/dependencies/impl_/check_optional_flag.cmake +++ b/cmake/cmaize/user_api/dependencies/impl_/check_optional_flag.cmake @@ -21,10 +21,10 @@ include(cmakepp_lang/cmakepp_lang) # # The various ``optional_dependency`` functions are tied to a configuration flag # which determines whether the option is enabled or not. Users need to provide -# those functions with the name of the flag NOT its value. This function wraps -# the error-checking logic for ensuring that users passsed the value. +# those functions with the name of the flag, NOT its value. This function wraps +# the error-checking logic for ensuring that users passed the value. # -# :param flag: Should be the name of a variable. +# :param flag: Name of the option variable. # :type flag: desc # # :raises RUNTIME_ERROR: If ``flag`` is not the name of a variable. In @@ -38,13 +38,12 @@ function(_check_optional_flag _cof_flag) if("${_cof_flag}" STREQUAL "") cpp_raise( RUNTIME_ERROR - "Expected variable serving as the flag, recived an empty string" - + "Expected variable serving as the flag, received an empty string" ) elseif("${_cof_type}" STREQUAL "bool") cpp_raise( RUNTIME_ERROR - "Expected variable serving as the flag, recieved boolean value." + "Expected variable serving as the flag, received boolean value." ) endif() diff --git a/tests/cmaize/user_api/dependencies/impl_/test_check_optional_flag.cmake b/tests/cmaize/user_api/dependencies/impl_/test_check_optional_flag.cmake index 136f64a0..97314e4e 100644 --- a/tests/cmaize/user_api/dependencies/impl_/test_check_optional_flag.cmake +++ b/tests/cmaize/user_api/dependencies/impl_/test_check_optional_flag.cmake @@ -53,6 +53,13 @@ function("${test_check_optional_flag}") endfunction() + ct_add_section(NAME "flag_value") + function("${flag_value}") + + set(ENABLE_DEPENDENCY ON) + _check_optional_flag("${ENABLE_DEPENDENCY}") + + endfunction() ct_add_section(NAME "valid_flag") function("${valid_flag}") diff --git a/tests/cmaize/user_api/dependencies/test_find_optional_dependency.cmake b/tests/cmaize/user_api/dependencies/test_find_optional_dependency.cmake index 6459aae2..96828929 100644 --- a/tests/cmaize/user_api/dependencies/test_find_optional_dependency.cmake +++ b/tests/cmaize/user_api/dependencies/test_find_optional_dependency.cmake @@ -23,7 +23,7 @@ function("${test_find_optional_dependency}") find_python(py_exe py_version) create_virtual_env( - venv_dir "${py_exe}" "${CMAKE_BINARY_DIR}" "${find_optional_dependency}" + venv_dir "${py_exe}" "${CMAKE_BINARY_DIR}" "${test_find_optional_dependency}" ) # Make sure everything is using the venv Python