Cmake complains about the wrong number of arguments

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

Error:

CMake error in src / Wt / Dbo / CMakeLists.txt: 18 (SET_TARGET_PROPERTIES): set_target_properties with the wrong number of arguments

If I remove it, it will be configured just fine.
Any idea why?

Thanks,
Omer

+4
source share
2 answers

Are you sure the variables are set correctly? I checked 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 SET(WTDBO_SOVERSION 1) , I get the same error message as you. The help for set_target_properties is as follows, so you are definitely doing the right thing:

Goals may have properties that affect their construction.

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

Set properties for the target. command syntax is a list of all the files that you want to change, and then specify the values ​​that you want to set. following. You can use any pair of reference values ​​you want and retrieve it later using GET_TARGET_PROPERTY .

+3
source

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

 SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION ${WTDBO_SOVERSION}) 

will become

 SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION) 

and it will cause an error. If blank lines are valid for your purpose, then surround the character in quotation marks. eg.

 SET_TARGET_PROPERTIES(wtdbo PROPERTIES SOVERSION "${WTDBO_SOVERSION}") 
+6
source

All Articles