Skip to content

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

@Andersama

Description

@Andersama

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.

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