Skip to content

Commit

Permalink
feat: Add project to test CMake export
Browse files Browse the repository at this point in the history
  • Loading branch information
gjasny committed Mar 20, 2020
1 parent eef4b55 commit f911bb0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/scripts/run-cmake-test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ctest -V
mkdir -p deploy
make DESTDIR="${PWD}/deploy" install

mkdir "${WORKSPACE}/_import_internal_deps" && cd $_
cmake .. -Dprometheus-cpp_DIR="${WORKSPACE}/_build_internal_deps/deploy/lib/cmake/prometheus-cpp"
make -j$(nproc)

# Build with external dependencies

mkdir "${WORKSPACE}/_build" && cd $_
Expand All @@ -21,3 +25,7 @@ make -j$(nproc)
ctest -V -LE Benchmark
mkdir -p deploy
make DESTDIR="${PWD}/deploy" install

mkdir "${WORKSPACE}/_import" && cd $_
cmake .. -Dprometheus-cpp_DIR="${WORKSPACE}/_build/deploy/lib/cmake/prometheus-cpp"
make -j$(nproc)
17 changes: 17 additions & 0 deletions cmake/project-import/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project(prometheus-cpp-import)

set(CMAKE_CXX_STANDARD 11)

find_package(prometheus-cpp CONFIG REQUIRED)

if(PROMETHEUS_CPP_ENABLE_PUSH)
add_executable(sample-client sample_client.cc)
target_link_libraries(sample-client PRIVATE prometheus-cpp::push)
endif()

if(PROMETHEUS_CPP_ENABLE_PULL)
add_executable(sample-server sample_server.cc)
target_link_libraries(sample-server PRIVATE prometheus-cpp::pull)
endif()
1 change: 1 addition & 0 deletions cmake/project-import/sample_client.cc
1 change: 1 addition & 0 deletions cmake/project-import/sample_server.cc

0 comments on commit f911bb0

Please sign in to comment.