-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for downstream using with cmake via prefix path (#1136)
* add test for downstream using with cmake via prefix path
- Loading branch information
Showing
6 changed files
with
111 additions
and
2 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
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
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,57 @@ | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Conduit. | ||
############################################################################### | ||
# | ||
# Example that shows how to use an installed instance of Conduit passed | ||
# via cmake prefix path in another CMake-based build system. | ||
# | ||
# To build: | ||
# cmake -DCMAKE_PREFIX_PATH={conduit install path} ../ -B build -S . | ||
# cmake --build build | ||
# cd build | ||
# ./conduit_example | ||
# | ||
# | ||
############################################################################### | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(using_with_cmake_prefix_path) | ||
|
||
################################################################ | ||
# Import conduit using find_package search | ||
################################################################ | ||
# | ||
# Add Conduit's install path to CMAKE_PREFIX_PATH | ||
# and use following find_package call to import conduit's targets | ||
# | ||
find_package(Conduit REQUIRED) | ||
|
||
|
||
###### | ||
# If Conduit was built with c++11 support, make sure we enable it | ||
###### | ||
if(CONDUIT_USE_CXX11) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
endif() | ||
|
||
####################################################### | ||
# create our example | ||
####################################################### | ||
add_executable(conduit_example conduit_example.cpp) | ||
|
||
# link to conduit targets | ||
target_link_libraries(conduit_example conduit::conduit) | ||
|
||
# if you are using conduit's python CAPI capsule interface | ||
# target_link_libraries(conduit_example conduit::conduit_python) | ||
|
||
|
||
# if you are using conduit's mpi features | ||
# if(NOT MPI_FOUND) | ||
# find_package(MPI COMPONENTS CXX) | ||
# endif() | ||
# target_link_libraries(conduit_example conduit::conduit_mpi) | ||
|
29 changes: 29 additions & 0 deletions
29
src/examples/using-with-cmake-prefix-path/conduit_example.cpp
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,29 @@ | ||
// Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
// Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
// other details. No copyright assignment is required to contribute to Conduit. | ||
|
||
//----------------------------------------------------------------------------- | ||
/// | ||
/// file: conduit_example.cpp | ||
/// | ||
//----------------------------------------------------------------------------- | ||
|
||
#include <iostream> | ||
|
||
#include "conduit.hpp" | ||
#include "conduit_relay.hpp" | ||
#include "conduit_blueprint.hpp" | ||
|
||
|
||
int main(int argc, char **argv) | ||
{ | ||
conduit::Node about; | ||
conduit::about(about["conduit"]); | ||
conduit::relay::about(about["conduit/relay"]); | ||
conduit::relay::io::about(about["conduit/relay/io"]); | ||
conduit::blueprint::about(about["conduit/blueprint"]); | ||
|
||
std::cout << about.to_yaml() << std::endl; | ||
} | ||
|
||
|
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
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