Skip to content

BTCPP_LIBRARY_VERSION can be set uncorrectly #1119

@Quentin-ET

Description

@Quentin-ET

Describe the bug

BTCPP_LIBRARY_VERSION can get the value of CMAKE_PROJECT_VERSION from the project parent.

grep -rnHe "BTCPP_LIBRARY_VERSION"
src/behavior_tree.cpp:118:    auto const parts = splitString(BTCPP_LIBRARY_VERSION, '.');
src/behavior_tree.cpp:127:  return BTCPP_LIBRARY_VERSION;
CMakeLists.txt:257:target_compile_definitions(${BTCPP_LIBRARY} PUBLIC BTCPP_LIBRARY_VERSION="${CMAKE_PROJECT_VERSION}")

How to Reproduce

I'm not totally sure how to reproduce.

Inside a CMakeList.txt:

  FetchContent_Declare(
    BehaviorTree
    GIT_REPOSITORY https://github.com/BehaviorTree/BehaviorTree.CPP.git
    GIT_TAG 4.6.2)
  FetchContent_MakeAvailable(BehaviorTree)

Compiling in verbose mode, you can see different values :

  • Either get the GIT_TAG of another FetchContent_Declare
... -DBTCPP_LIBRARY_VERSION=\"0.11.1\"
  • or a dummy value:
... -DBTCPP_LIBRARY_VERSION=\"\"
  • or even:
... -DBTCPP_LIBRARY_VERSION=\"1.0.0\"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions