Skip to content

Commit

Permalink
saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Nov 9, 2023
0 parents commit 4e35df8
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Ubuntu 22.04

on: [push, pull_request]

jobs:
ubuntu-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Use cmake
run: |
cmake -B build .
cmake --build build
./build/repro
40 changes: 40 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 3.15)

project(FetchContentDemo VERSION 0.1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FetchContent)

FetchContent_Declare(
ada
GIT_REPOSITORY [email protected]:ada-url/ada.git
GIT_SHALLOW TRUE
GIT_TAG tags/v2.7.2
)

FetchContent_MakeAvailable(ada)



file(WRITE main.cpp "
#include \"ada.h\"
#include <iostream>
int main(int, char *[]) {
auto url = ada::parse<ada::url>(\"https://www.google.com\");
if (!url) {
std::cout << \"failure\" << std::endl;
return EXIT_FAILURE;
}
url->set_protocol(\"http\");
std::cout << url->get_protocol() << std::endl;
std::cout << url->get_host() << std::endl;
return EXIT_SUCCESS;
}")



add_executable(repro main.cpp)
target_link_libraries(repro PUBLIC ada)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ada_fetchcontent

Demonstrates how to use ada as a CMake dependency with
`FetchContent`.

```
cmake -B build
cmake --build build
./build/repro
```

0 comments on commit 4e35df8

Please sign in to comment.