vcpkg/ports/libsodium/sodiumConfig.cmake.in
Kai Pastor 7a7ef70514
[libsodium] Use official build systems (#36800)
Drop the complex and undermaintained build system vendored into the
port.
Use msbuild for windows, and autotools otherwise.

Note: Users who change options via triplet files
(`VCPKG_CMAKE_CONFIGURE_OPTIONS`) must/can migrate to the official
options (via `VCPKG_CONFIGURE_MAKE_OPTIONS`; no equivalent for
msbuild?).

Should resolve #32888 according to my earlier ["the build also succeeds
with the official autoconf build
system."](https://github.com/microsoft/vcpkg/issues/32888#issuecomment-1662730210)
Should resolve #36777.
2024-02-21 22:07:27 -08:00

33 lines
1.5 KiB
CMake

if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
include(CMakeFindDependencyMacro)
find_dependency(Threads)
endif()
if(NOT TARGET unofficial-sodium::sodium)
add_library(unofficial-sodium::sodium UNKNOWN IMPORTED)
set_target_properties(unofficial-sodium::sodium PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
)
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
set_target_properties(unofficial-sodium::sodium PROPERTIES
INTERFACE_LINK_LIBRARIES Threads::Threads
)
endif()
find_library(VCPKG_SODIUM_LIBRARY_RELEASE NAMES sodium libsodium PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
if(EXISTS "${VCPKG_SODIUM_LIBRARY_RELEASE}")
set_property(TARGET unofficial-sodium::sodium APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release")
set_target_properties(unofficial-sodium::sodium PROPERTIES IMPORTED_LOCATION_RELEASE "${VCPKG_SODIUM_LIBRARY_RELEASE}")
endif()
find_library(VCPKG_SODIUM_LIBRARY_DEBUG NAMES sodium libsodium PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
if(EXISTS "${VCPKG_SODIUM_LIBRARY_DEBUG}")
set_property(TARGET unofficial-sodium::sodium APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
set_target_properties(unofficial-sodium::sodium PROPERTIES IMPORTED_LOCATION_DEBUG "${VCPKG_SODIUM_LIBRARY_DEBUG}")
endif()
endif()