Created
November 29, 2023 16:01
-
-
Save ardabbour/43950b723be7a20f9468d5af789a0259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# consuming sodium in cmake is a needlessly difficult task. | |
include(ExternalProject) | |
set(SODIUM_VERSION 1.0.19) | |
ExternalProject_Add( | |
sodium | |
URL https://download.libsodium.org/libsodium/releases/libsodium-${SODIUM_VERSION}.tar.gz | |
PREFIX ${CMAKE_BINARY_DIR}/_deps/sodium # this is to avoid having a system install | |
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> ./configure --prefix=<INSTALL_DIR> | |
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make | |
INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> make install | |
) | |
# later on, we can consume it like this | |
# ExternalProject_Get_Property(sodium INSTALL_DIR) | |
# add_dependencies(${PROJECT_NAME} sodium) | |
# target_include_directories(${PROJECT_NAME} PRIVATE ${INSTALL_DIR}/include) | |
# target_link_libraries(${PROJECT_NAME} ${INSTALL_DIR}/lib/libsodium.a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment