Link between "cmake -B" and CMAKE_CURRENT_BINARY_DIR

Hello,

Could you please confirm me that CMAKE_CURRENT_BINARY_DIR is set by cmake -B ?

If so, it would be good the documentation mentions explicitly this link (documentation of one of them referring the other one).

CMAKE_CURRENT_BINARY_DIR changes on each add_subdirectory call, so this seems like the wrong link to me. It is, instead, closer to CMAKE_BINARY_DIR.

So the -B switch would match to the CMAKE_CURRENT_BINARY_DIR of the root CMakeLists.txt, and then would be the same as CMAKE_BINARY_DIR ?

EDIT : fixed typo on the switch

If you meant -B, then this sounds right to me.

1 Like