mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-12 18:20:27 +01:00
Install cmake export file
This commit is contained in:
parent
c7d5f2cbec
commit
c5dac2bc0b
@ -34,7 +34,16 @@ target_include_directories(valijson INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
|
||||
install(DIRECTORY include/ DESTINATION include)
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
install(TARGETS valijson
|
||||
EXPORT valijsonConfig
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
install(EXPORT valijsonConfig
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/valijson"
|
||||
)
|
||||
|
||||
if(NOT valijson_BUILD_TESTS AND NOT valijson_BUILD_EXAMPLES)
|
||||
return()
|
||||
|
23
README.md
23
README.md
@ -147,7 +147,11 @@ The examples and test suite can be built using cmake:
|
||||
# Run test suite (from build directory)
|
||||
./test_suite
|
||||
```
|
||||
#### How to add this library to your cmake target ####
|
||||
## How to add this library to your cmake target ##
|
||||
|
||||
Valijson can be integrated either as git submodule or with find_package().
|
||||
|
||||
### Valijson as git submodule ###
|
||||
|
||||
Download this repository into your project
|
||||
|
||||
@ -172,7 +176,24 @@ add_executable(your-executable ...)
|
||||
|
||||
target_link_libraries(your-executable ValiJSON::valijson)
|
||||
```
|
||||
### Install Valijson and import it ###
|
||||
|
||||
It is possible to install headers by running cmake's install command from the build tree. Once Valijson is installed, use it from other CMake projects using `find_package(Valijson)` in your CMakeLists.txt.
|
||||
```bash
|
||||
# Install Valijson
|
||||
git clone --depth=1 git@github.com:tristanpenman/valijson.git
|
||||
cd valijson
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --install .
|
||||
```
|
||||
```cmake
|
||||
# Import installed valijson and link it to your executable
|
||||
find_package(valijson REQUIRED)
|
||||
add_executable(executable main.cpp)
|
||||
target_link_libraries(executable valijson)
|
||||
```
|
||||
### Xcode ###
|
||||
|
||||
An Xcode project has also been provided, in the 'xcode' directory. Note that in order to run the test suite, you may need to configure the working directory for the 'test\_suite' scheme. It is recommended that you use the 'xcode' directory as the working directory.
|
||||
|
Loading…
Reference in New Issue
Block a user