tags:

views:

349

answers:

2
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

+2  A: 

Are you sure you have the variables set correctly? I've checked with this CMakeLists.txt file, and it works correctly:

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(test CXX)
ADD_LIBRARY(wtdbo SHARED test.cc)
SET(WTDBO_SOVERSION 1)
SET(VERSION_SERIES 1)
SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 0)

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

However, if I comment out the SET(WTDBO_SOVERSION 1) line I get the same error message as you do. The help for set_target_properties is as follows, so you are definitely doing the right thing:

Targets can have properties that affect how they are built.

set_target_properties(target1 target2 ...
        PROPERTIES prop1 value1
        prop2 value2 ...)

Set properties on a target. The syntax for the command is to list all the files you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it later with the GET_TARGET_PROPERTY command.

rq
+2  A: 

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}")
brofield