🛠️ User set CMake install subdirectory + cross-platform default location (#142)

* Changed the JWT_CMAKE_FILES_INSTALL_DIR such that it is found on both Windows and Unix and that it may be configured to something entirely different

* Update cmake.yml

* Update cmake.yml

* Update CMakeLists.txt

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update .github/workflows/cmake.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update .github/workflows/cmake.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

* Update .github/workflows/cmake.yml

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>

Co-authored-by: Arjen Hoogesteger <arjen.hoogesteger@sweco.nl>
Co-authored-by: Arjen Hoogesteger <65287900+sweco-nlahoo@users.noreply.github.com>

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update traits.yml

* trying different cmake path + debug in actions

* fix typo

* quick test for installing in lib dir

* revert

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
This commit is contained in:
Arjen Hoogesteger
2021-05-19 17:50:22 +02:00
committed by GitHub
parent 0d10b631ea
commit 14061f1e11
3 changed files with 69 additions and 7 deletions

View File

@@ -13,6 +13,45 @@ on:
- ".github/workflows/cmake.yml"
jobs:
default-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: lukka/get-cmake@latest
- name: setup
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
sudo make install
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
default-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: lukka/get-cmake@latest
- run: choco install openssl
- name: setup
run: |
cmake -E make_directory build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
cmake --install .
- name: test
run: |
cd tests/cmake
cmake . -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
min-req:
runs-on: ubuntu-latest
steps:
@@ -34,10 +73,10 @@ jobs:
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake -DTEST:STRING="defaults-enabled"
cmake . -DTEST:STRING="defaults-enabled"
cmake --build .
custom-install:
custom-install-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -54,7 +93,27 @@ jobs:
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH=/opt/jwt-cpp/cmake -DTEST:STRING="defaults-enabled"
cmake . -DCMAKE_PREFIX_PATH="/opt/jwt-cpp" -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
custom-install-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: lukka/get-cmake@latest
- run: choco install openssl
- name: setup
run: |
cmake -E make_directory build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="C:/jwt-cpp" -DJWT_BUILD_EXAMPLES=OFF
cmake --install .
- name: test
run: |
cd tests/cmake
cmake . -DCMAKE_PREFIX_PATH="C:/jwt-cpp" -DTEST:STRING="defaults-enabled" -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
no-pico:

View File

@@ -25,12 +25,12 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DJWT_BUILD_EXAMPLES=OFF
sudo make install
cmake .. -DJWT_BUILD_EXAMPLES=OFF -DCMAKE_FIND_DEBUG_MODE=1
sudo cmake --install .
- name: test
run: |
cd tests/jsoncons
cmake . -DCMAKE_PREFIX_PATH=/usr/local/cmake
cmake . -DCMAKE_FIND_DEBUG_MODE=1
cmake --build .
./jsoncons-traits-narrow

View File

@@ -64,7 +64,10 @@ if(JWT_EXTERNAL_PICOJSON)
target_link_libraries(jwt-cpp INTERFACE picojson::picojson>)
endif()
set(JWT_CMAKE_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/cmake/jwt-cpp)
if(NOT JWT_CMAKE_FILES_INSTALL_DIR)
set(JWT_CMAKE_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/cmake)
endif()
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/jwt-cpp-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/jwt-cpp-config.cmake
INSTALL_DESTINATION ${JWT_CMAKE_FILES_INSTALL_DIR} PATH_VARS JWT_EXTERNAL_PICOJSON JWT_SSL_LIBRARY)