-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4e35df8
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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) |
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
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 | ||
``` |