Skip to content

Commit

Permalink
Changed for better CMake compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jeppefrandsen committed May 4, 2021
1 parent b1db67e commit 977da81
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ LIST (APPEND CMAKE_MODULE_PATH "${TOOLS_DIRECTORY}/cmake/doxygen")
INCLUDE(GetGitRevisionDescription)
INCLUDE(cpplint)
INCLUDE(UseDoxygen)
INCLUDE(GNUInstallDirs)

get_git_head_revision(GIT_REFSPEC GIT_SHA1)
git_get_exact_tag(GIT_TAG)
Expand Down Expand Up @@ -124,6 +125,9 @@ ENDIF()

# General include directories
INCLUDE_DIRECTORIES(src/include/ src/include/private)
if (EXTRA_INCLUDE_DIRECTORIES)
INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRECTORIES})
endif()
ADD_SUBDIRECTORY (src)

#-------------------
Expand Down
14 changes: 8 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,23 @@ SET_TARGET_PROPERTIES(jwt PROPERTIES PUBLIC_HEADER "${JWT_HDR}")
# Install targets.
INSTALL(TARGETS jwt
EXPORT JwtTargets
LIBRARY DESTINATION "${JWT_INSTALL_LIB_DIR}" COMPONENT lib
ARCHIVE DESTINATION "${JWT_INSTALL_LIB_DIR}" COMPONENT lib
RUNTIME DESTINATION "${JWT_INSTALL_BIN_DIR}" COMPONENT lib
PUBLIC_HEADER DESTINATION "${JWT_INSTALL_INCLUDE_DIR}/jwt" COMPONENT lib)
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/jwt" COMPONENT lib)

ADD_STYLE_CHECK_TARGET(lint "${JWT_SRC}")

set_property(TARGET jwt PROPERTY VERSION ${JWT_VERSION})
set_property(TARGET jwt PROPERTY SOVERSION ${JWT_VERSION_MAJOR})
set_property(TARGET jwt PROPERTY DEBUG_POSTFIX d)

SET( CMAKECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/Jwt )
#Some boiler plate code to generate the cmake module files for Jwt
install(EXPORT JwtTargets
FILE JwtTargets.cmake
NAMESPACE Jwt::
DESTINATION ${JWT_INSTALL_LIB_DIR}/cmake/Jwt
DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file("JwtConfigVersion.cmake"
Expand All @@ -62,8 +63,9 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/JwtConfig.cmake" "
include(\"\${CMAKE_CURRENT_LIST_DIR}/JwtTargets.cmake\")
")


install(FILES
${CMAKE_CURRENT_BINARY_DIR}/JwtConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/JwtConfig.cmake
DESTINATION ${JWT_INSTALL_LIB_DIR}/cmake/Jwt
DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
2 changes: 1 addition & 1 deletion src/include/jwt/claimvalidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef SRC_INCLUDE_JWT_CLAIMVALIDATOR_H_
#define SRC_INCLUDE_JWT_CLAIMVALIDATOR_H_

#include "jwt/json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/jwt_error.h"
#include <memory>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/include/jwt/claimvalidatorfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef SRC_INCLUDE_JWT_CLAIMVALIDATORFACTORY_H_
#define SRC_INCLUDE_JWT_CLAIMVALIDATORFACTORY_H_

#include "json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/claimvalidator.h"
#include <exception>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/include/jwt/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <tuple>
#include <utility>
#include "jwt/claimvalidator.h"
#include "jwt/json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/messagevalidator.h"

// Stack allocated signature.
Expand Down
2 changes: 1 addition & 1 deletion src/include/jwt/messagevalidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <string.h>
#include <string>
#include "jwt/allocators.h"
#include "jwt/json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/jwt_error.h"

using json = nlohmann::json;
Expand Down
2 changes: 1 addition & 1 deletion src/include/jwt/messagevalidatorfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef SRC_INCLUDE_JWT_MESSAGEVALIDATORFACTORY_H_
#define SRC_INCLUDE_JWT_MESSAGEVALIDATORFACTORY_H_

#include "json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/kidvalidator.h"
#include "jwt/messagevalidator.h"
#include <exception>
Expand Down
2 changes: 1 addition & 1 deletion src/validators/claims/claimvalidatorfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "jwt/timevalidator.h"
#include "private/buildwrappers.h"

#include "jwt/json.hpp"
#include <nlohmann/json.hpp>
using json = nlohmann::json;

ClaimValidatorFactory::~ClaimValidatorFactory() {
Expand Down
2 changes: 1 addition & 1 deletion src/validators/messagevalidatorfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <vector>
#include "jwt/allocators.h"
#include "jwt/hmacvalidator.h"
#include "jwt/json.hpp"
#include <nlohmann/json.hpp>
#include "jwt/kidvalidator.h"
#include "jwt/nonevalidator.h"
#include "jwt/rsavalidator.h"
Expand Down
2 changes: 1 addition & 1 deletion test/validators/claim_validators_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#else
#include <unistd.h>
#endif
#include <jwt/json.hpp>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

Expand Down

0 comments on commit 977da81

Please sign in to comment.