Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhongwm opened this issue Nov 14, 2023 · 0 comments
Open

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

zhongwm opened this issue Nov 14, 2023 · 0 comments

Comments

@zhongwm
Copy link

zhongwm commented Nov 14, 2023

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] 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant