Add example CMake project that uses UDPC
This commit is contained in:
parent
c6a4891ad4
commit
ba2697d0b8
4 changed files with 52 additions and 0 deletions
25
conan_usage_example/CMakeLists.txt
Normal file
25
conan_usage_example/CMakeLists.txt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
project(UDPC_NetworkTest C)
|
||||||
|
|
||||||
|
set(UDPC_NetworkTest_SOURCES
|
||||||
|
src/UDPC_NetworkTest.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_compile_options(
|
||||||
|
-Wall -Wextra -Wpedantic -Wno-missing-braces
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-Weffc++>
|
||||||
|
$<$<CONFIG:DEBUG>:-Og>
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "Setting build type to 'Debug', none was specified.")
|
||||||
|
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(udpc CONFIG REQUIRED)
|
||||||
|
|
||||||
|
add_executable(UDPC_NetworkTest
|
||||||
|
${UDPC_NetworkTest_SOURCES}
|
||||||
|
)
|
||||||
|
target_link_libraries(UDPC_NetworkTest udpc::udpc)
|
9
conan_usage_example/conanfile.txt
Normal file
9
conan_usage_example/conanfile.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[requires]
|
||||||
|
udpc/1.0
|
||||||
|
|
||||||
|
[generators]
|
||||||
|
CMakeDeps
|
||||||
|
CMakeToolchain
|
||||||
|
|
||||||
|
[options]
|
||||||
|
udpc*:shared=True
|
17
conan_usage_example/setup_build_with_conan.sh
Executable file
17
conan_usage_example/setup_build_with_conan.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
set -ve
|
||||||
|
|
||||||
|
if ! [[ -e "${HOME}/.conan2/profiles/default" ]]; then
|
||||||
|
conan profile detect
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep stephens_forgejo "${HOME}/.conan2/remotes.json" >&/dev/null; then
|
||||||
|
conan remote add stephens_forgejo "https://git.seodisparate.com/api/packages/stephenseo/conan"
|
||||||
|
fi
|
||||||
|
|
||||||
|
conan install . -r stephens_forgejo -r conancenter --output-folder=buildConan --build=missing
|
||||||
|
cmake -S . -B buildConan -DCMAKE_TOOLCHAIN_FILE=buildConan/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build buildConan
|
1
conan_usage_example/src/UDPC_NetworkTest.c
Symbolic link
1
conan_usage_example/src/UDPC_NetworkTest.c
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../src/test/UDPC_NetworkTest.c
|
Loading…
Reference in a new issue