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

Installing #147

Closed
ThomasP1988 opened this issue Sep 20, 2020 · 4 comments
Closed

Installing #147

ThomasP1988 opened this issue Sep 20, 2020 · 4 comments

Comments

@ThomasP1988
Copy link

Hi everyone,
Sorry i'm quite new with C++ and i can't figure out how to install this library

i've tried
add_library(daw STATIC) target_include_directories(daw PUBLIC ${PROJECT_SOURCE_DIR}/external/daw) add_library(third_party STATIC) target_include_directories(third_party PUBLIC ${PROJECT_SOURCE_DIR}/external/third_party) target_link_libraries(${LIBRARY_NAME} PUBLIC doctest daw third_party)

but in my main.cpp i get this error when "make"
fatal error: daw/json/daw_json_link.h: No such file or directory 29 | #include "daw/json/daw_json_link.h"

Does anyone have any idea how to install it easily?

@beached
Copy link
Owner

beached commented Sep 20, 2020

With the old version, one needed to clone the three repos and have them in the include path.
In dev, and in the last prerelease https://github.com/beached/daw_json_link/releases/tag/v1.9.2 which should be stable and is nearing the v2.0 release one can use cmake's fetchcontent or do an install of the library. I would recommend using the v1.9.2. linked above as it's only deficiency compared to the v1 is the documentation isn't fully updated. It does include an extensive set of test/example files in tests though.

If you want v2. and the prerelease for the way to include in your cmake project is to

include( FetchContent )
FetchContent_Declare(
        daw_json_link
        GIT_REPOSITORY https://github.com/beached/daw_json_link
        GIT_TAG v1.9.2
)
FetchContent_MakeAvailable(daw_json_link)

then in your target_link_libraries it's just

target_link_libraries( MyTarget daw::json_link )

And the include paths would be set for everything needed and cmake will pull in the dependencies needed

@beached
Copy link
Owner

beached commented Sep 21, 2020

The release branch is now at v2. So the above instructions can be

include( FetchContent )
FetchContent_Declare(
        daw_json_link
        GIT_REPOSITORY https://github.com/beached/daw_json_link
)
FetchContent_MakeAvailable(daw_json_link)

then in your target_link_libraries it's just

target_link_libraries( MyTarget daw::json_link )

@ThomasP1988
Copy link
Author

ThomasP1988 commented Sep 22, 2020

@beached Couldnt expect a better answer, thank you.

FYI, When installing it, it seemed that Cmake was by default looking for master branch.

include( FetchContent ) FetchContent_Declare( daw_json_link GIT_REPOSITORY https://github.com/beached/daw_json_link GIT_TAG release ) FetchContent_MakeAvailable(daw_json_link)

specifying the branch helped.

@beached
Copy link
Owner

beached commented Sep 22, 2020

Thanks, I'll update the docs. Too bad that cmake doesn't use the default branch.

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

2 participants