Skip to content

Commit

Permalink
Put quotes around ${MACRO_DEFINE_NAME} in if-statement (#516)
Browse files Browse the repository at this point in the history
This is a safer way to check for an empty var I have found in the past.
Something strange happens with macro arguments (at least in older versions of
CMake).

This is in response to feedback from @KyleFromKitware while reviewing PR #521.
  • Loading branch information
bartlettroscoe committed Aug 26, 2022
1 parent 2160230 commit c5805da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tribits/core/package_arch/TribitsAddOptionAndDefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ macro(tribits_add_option_and_define USER_OPTION_NAME MACRO_DEFINE_NAME
)
#message("TRIBITS_ADD_OPTION_AND_DEFINE: '${USER_OPTION_NAME}' '${MACRO_DEFINE_NAME}' '${DEFAULT_VALUE}'")
set( ${USER_OPTION_NAME} "${DEFAULT_VALUE}" CACHE BOOL "${DOCSTRING}" )
if(NOT ${MACRO_DEFINE_NAME} STREQUAL "")
if(NOT "${MACRO_DEFINE_NAME}" STREQUAL "")
if(${USER_OPTION_NAME})
global_set(${MACRO_DEFINE_NAME} ON)
else()
global_set(${MACRO_DEFINE_NAME} OFF)
endif()
endif()
tribits_pkg_export_cache_var(${USER_OPTION_NAME})
if(NOT ${MACRO_DEFINE_NAME} STREQUAL "")
if(NOT "${MACRO_DEFINE_NAME}" STREQUAL "")
tribits_pkg_export_cache_var(${MACRO_DEFINE_NAME})
endif()
endmacro()
Expand Down

0 comments on commit c5805da

Please sign in to comment.