Skip to content

Problem with cmake FetchContent_* both oatpp-swagger and oatpp #87

Open
@zhongwm

Description

@zhongwm

Problem with cmake FetchContent_* both oatpp-swagger and oatpp.

If I use FetchContent_* to install oatpp solely, it works.
Then if I add another FetchContent for oatpp-swagger, it fails.

include(FetchContent)
FetchContent_Declare(
    oatpp-swagger
    GIT_REPOSITORY https://github.com/oatpp/oatpp-swagger
    GIT_TAG 1.3.0
    OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(
    oatpp-swagger
)

message(STATUS "oatpp-swagger_DIR ${oatpp-swagger_DIR}")
find_package(oatpp-swagger 1.3.0 REQUIRED)

The one for importing oatpp:

include(FetchContent)
FetchContent_Declare(
    oatpp
    GIT_REPOSITORY https://github.com/oatpp/oatpp
    GIT_TAG 1.3.0
    OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(
    oatpp
)

message(STATUS "oatpp_DIR ${oatpp_DIR}")
find_package(oatpp 1.3.0 REQUIRED)

The line I use oatpp is target_link_libraries(myproject oatpp) (this line works), but fail if changed to target_link_libraries(myproject oatpp oatpp-swagger) , and the cause is when configuring the oatpp-swagger.

Error while configuring:

[cmake] Finding oatpp in location=INSTALLED
[cmake] CMake Error at build/_deps/oatpp-swagger-src/CMakeLists.txt:42 (get_target_property):
[cmake]   get_target_property() called with non-existent target "oatpp::oatpp".
[cmake] 

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