CMAKE_NUM_BITS | Minor quality of life

Here is a common pattern in our code base:

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
    set_target_properties(foobar PROPERTIES OUTPUT_NAME foobar64)
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
    set_target_properties(foobar PROPERTIES OUTPUT_NAME foobar32)
else()
    message(FATAL_ERROR "Invalid")
endif()

It would be nice to have this instead:

set_target_properties(foobar PROPERTIES OUTPUT_NAME foobar${CMAKE_NUM_BITS})

I can present more cases for this variable if needed. Also the name is very changeable/subjective.

Thoughts?

  • Juan

You can use the math() command to calculate that yourself

@hsattler you are correct. We already have code that does this.

It would just be a minor quality of life to have it already pre-calculated just like CMAKE_SIZEOF_VOID_P.