aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt56
1 files changed, 18 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 208265a..4c521c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.19)
cmake_policy(SET CMP0135 NEW)
-project(NostrSDK VERSION 0.0.1)
+project(NostrSDK VERSION 0.1.0)
include(ExternalProject)
include(FetchContent)
@@ -9,8 +9,6 @@ include(FetchContent)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/_deps)
-
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT)
message(STATUS "Configuring as a subproject.")
@@ -20,52 +18,36 @@ if(HAS_PARENT)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../out/${CMAKE_BUILD_TYPE}/lib/)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/../env/)
- set(Boost_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../env/boost/include)
+ if(DEFINED ENV{WORKSPACE})
+ list(APPEND CMAKE_PREFIX_PATH $ENV{WORKSPACE}/env)
+ else()
+ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/../env)
+ endif()
else()
message(STATUS "Configuring as a standalone project.")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}/bin/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}/lib/)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}/lib/)
-
- set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include/)
- set(OPENSSL_LIBRARIES ${OPENSSL_ROOT_DIR}/lib/)
-endif()
-
-if(DEFINED ENV{WORKSPACE})
- list(APPEND CMAKE_PREFIX_PATH $ENV{WORKSPACE}/env)
-else()
- list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/../env)
endif()
-#======== Find unmanaged dependencies ========#
+#======== Find dependencies ========#
+find_package(nlohmann_json CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
-find_package(Boost REQUIRED COMPONENTS filesystem system thread regex)
+find_package(plog CONFIG REQUIRED)
+find_package(websocketpp CONFIG REQUIRED)
-#======== Fetch header-only dependencies ========#
-FetchContent_Declare(
- nlohmann_json
- URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
- URL_HASH SHA256=d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d
- USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_Declare(
- plog
- URL https://github.com/SergiusTheBest/plog/archive/refs/tags/1.1.10.tar.gz
- USES_TERMINAL_DOWNLOAD TRUE
-)
-FetchContent_Declare(
- websocketpp
- GIT_REPOSITORY git@github.com:zaphoyd/websocketpp.git
- GIT_TAG 0.8.2
-)
+#======== Configure uuid_v4 ========#
FetchContent_Declare(
uuid_v4
- URL https://github.com/crashoz/uuid_v4/archive/refs/tags/v1.0.0.tar.gz
- USES_TERMINAL_DOWNLOAD TRUE
+ GIT_REPOSITORY git@github.com:crashoz/uuid_v4.git
+ GIT_TAG v1.0.0
)
+FetchContent_Populate(uuid_v4)
+set(uuid_v4_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/uuid_v4-src/)
-FetchContent_MakeAvailable(nlohmann_json plog uuid_v4 websocketpp)
+find_path(uuid_v4_INCLUDE_DIR uuid_v4.h)
+include_directories(${uuid_v4_INCLUDE_DIR})
#======== Build the project ========#
set(INCLUDE_DIR ./include)
@@ -93,7 +75,6 @@ target_link_libraries(NostrSDK PRIVATE
OpenSSL::SSL
OpenSSL::Crypto
plog::plog
- uuid_v4::uuid_v4
websocketpp::websocketpp
)
set_target_properties(NostrSDK PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
@@ -124,7 +105,6 @@ target_link_libraries(NostrSDKTest PRIVATE
GTest::gtest_main
NostrSDK
plog::plog
- uuid_v4::uuid_v4
websocketpp::websocketpp
)
set_target_properties(NostrSDKTest PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)