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

Clearer instructions for windows on how to include this in another cmake project using vcpkg #533

Open
Andersama opened this issue Nov 26, 2022 · 1 comment

Comments

@Andersama
Copy link

Andersama commented Nov 26, 2022

I installed this from vcpkg. Had no luck trying to find an example CMakeLists.txt file. I went and looked at stubby's source code to find a find_package directive which does not appear to work. Looking at the readme:

Once these are installed, set CMake variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH to the vcpkg include and library directories e.g. ../vcpkg/installed/x64-windows/include and ../vcpkg/installed/x64-windows/lib.

This at best in my case included the header file, but did not include the library into the project. Currently it seems that the vcpkg install builds the project as a library (static or dynamic depending on the triplet). It's relatively straightforward to include the header with cmake.

target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_INCLUDE_PATH}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")

But what to do with the .lib file I'm not too sure, for one the file appears to be named differently between the static and dynamic versions so that's a bit confusing. It appears to be either getdns.lib or getdns_static.lib.

target_link_libraries(${PROJECT_NAME} PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/getdns.lib")
#target_link_libraries(${PROJECT_NAME} PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/getdns_static.lib")

These two steps appear to be all that's necessary to get cmake to function*. Granted, the .dll file may need to be copied over depending on which triplet is used.

@garthgoodson
Copy link

In the vcpkg ports dir there should really be a getdns-config.in.cmake file that defines how to use find_package() and link_libraries, like other ports have.

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