Cmake complains about wrong number of arguments

cmake

SET_TARGET_PROPERTIES(
  wtdbo
PROPERTIES
  VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
  SOVERSION ${WTDBO_SOVERSION}
  DEBUG_POSTFIX "d"
)

The error is:

CMake Error at src/Wt/Dbo/CMakeLists.txt:18 (SET_TARGET_PROPERTIES):
set_target_properties called with incorrect number of arguments

If I remove it it configures just fine.
Any idea why?

Thanks,
Omer

Best Answer

Remember that this is a macro, so symbols are replaced before being evaluated. This means that symbols that are empty strings will be replaced to nothing before being evaluated. Thus, if WTDBO_SOVERSION is "" then

SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION ${WTDBO_SOVERSION})

would become

SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION)

and this would trigger the error. If empty strings are valid for your purpose then surround the symbol in quotes. e.g.

SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION "${WTDBO_SOVERSION}")
Related Topic