Skip to content

Commit

Permalink
build: unbreak configure stage when RELWITHDEBINFO is blank/has space
Browse files Browse the repository at this point in the history
[ Upstream commit 9c512b8 ]

When cmake is invoked with either an empty argument or one that
involves a space,

```sh
cmake ... -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=""`
cmake ... -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="-O2 -O2"
```

then rdma's CMakeLists.txt falls on its face:

[    3s] CMake Error at buildlib/RDMA_BuildType.cmake:32 (if):
[    3s]   if given arguments:
[    3s]
[    3s]     "STREQUAL" " -O2 -g -DNDEBUG"
[    3s]
[    3s]   Unknown arguments specified

Fixes: 7cb1daa ("Be consistent about defining NDEBUG")
Signed-off-by: Nicolas Morey <[email protected]>
  • Loading branch information
jengelh authored and nmorey committed Sep 5, 2023
1 parent 8437d7e commit 91ca390
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion buildlib/RDMA_BuildType.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(RDMA_BuildType)
# with the -DNDEBUG removed
foreach (language CXX C)
set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELWITHDEBINFO")
if (${${VAR_TO_MODIFY}} STREQUAL ${${VAR_TO_MODIFY}_INIT})
if ("${${VAR_TO_MODIFY}}" STREQUAL "${${VAR_TO_MODIFY}_INIT}")
string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )"
" "
replacement
Expand Down

0 comments on commit 91ca390

Please sign in to comment.