Skip to content

bug: cpp bindings can not be compiled in windows #6233

@CNLHC

Description

@CNLHC

Describe the bug

  1. c++ standard mismatch

Currently c++ 17 is used at

set(CMAKE_CXX_STANDARD 17)

But Designated Initializers is c++ 20 feature.

.type = static_cast<EntryMode>(meta.mode),

.path = std::string(std::move(other.path)),

  1. target_link_libraries issue

On windows platform, some extra depdencies are linked to target using plain-style (without PRIVATE or PUBLIC)

target_link_libraries(opendal_cpp userenv ws2_32 bcrypt)

But there exist several keyword-style linking.

target_link_libraries(opendal_cpp userenv ws2_32 bcrypt)

Using both plain and keyword for the same target is not allowed in cmake

  1. path issue

Regular expression is used to handle path at

string(REGEX REPLACE "/Cargo.toml\n$" "/target" CARGO_TARGET_DIR "${CARGO_TARGET_DIR}")

On windows platform, the line terminator can be \r\n. Therefore this regex may generate wrong result with unexpected \r

Steps to Reproduce

Compiling the cpp bindings sample can reproduce this problem

Expected Behavior

cpp bindings sample should be compiled properly.

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions