diff options
author | Finrod Felagund <finrod.felagund.97@gmail.com> | 2024-05-15 16:41:51 +0200 |
---|---|---|
committer | Finrod Felagund <finrod.felagund.97@gmail.com> | 2024-05-16 16:29:32 +0200 |
commit | 0f4494bf6b292ad7883219cd6628689e7ddb9438 (patch) | |
tree | 0ef6cf185e901f2df9faa594e3dcf37bee382a52 | |
parent | 663fb4e7199e1b4318a5bc107096f6a529823e02 (diff) |
better management of include_dir and headers
-rw-r--r-- | CMakeLists.txt | 29 | ||||
-rw-r--r-- | README.md | 4 |
2 files changed, 16 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ce940bb..744eccf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.19) -cmake_policy(SET CMP0135 NEW) + +if(CMAKE_VERSION VERSION_GREATER "3.24.0") + # FIXME this policy isn't compatible with versions prior to 3.24 + cmake_policy(SET CMP0135 NEW) +endif() project(aedile VERSION 0.0.2) include(ExternalProject) @@ -39,27 +43,18 @@ find_package(plog CONFIG REQUIRED) find_package(websocketpp CONFIG REQUIRED) #======== Configure uuid_v4 ========# + FetchContent_Declare( uuid_v4 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/) - -find_path(uuid_v4_INCLUDE_DIR uuid_v4.h) -include_directories(${uuid_v4_INCLUDE_DIR}) +FetchContent_MakeAvailable(uuid_v4) #======== Build the project ========# -set(INCLUDE_DIR ./include) -set(CLIENT_INCLUDE_DIR ./include/client) -include_directories(${INCLUDE_DIR}) -include_directories(${CLIENT_INCLUDE_DIR}) - -set(HEADERS - ${INCLUDE_DIR}/nostr.hpp - ${CLIENT_INCLUDE_DIR}/web_socket_client.hpp -) +list(APPEND INCLUDE_DIR ./include) +list(APPEND INCLUDE_DIR ./include/client) +list(APPEND INCLUDE_DIR ${CMAKE_SOURCE_DIR}/build/linux/_deps/uuid_v4-src/) set(SOURCE_DIR ./src) set(CLIENT_SOURCE_DIR ./src/client) @@ -70,7 +65,7 @@ set(SOURCES ${CLIENT_SOURCE_DIR}/websocketpp_client.cpp ) -add_library(aedile ${SOURCES} ${HEADERS}) +add_library(aedile ${SOURCES}) target_link_libraries(aedile PRIVATE nlohmann_json::nlohmann_json OpenSSL::SSL @@ -78,6 +73,7 @@ target_link_libraries(aedile PRIVATE plog::plog websocketpp::websocketpp ) +target_include_directories(aedile PUBLIC ${INCLUDE_DIR}) set_target_properties(aedile PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES) #======== Build the tests ========# @@ -108,6 +104,7 @@ target_link_libraries(aedile_test PRIVATE plog::plog websocketpp::websocketpp ) +target_include_directories(aedile_test PUBLIC ${INCLUDE_DIR}) set_target_properties(aedile_test PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES) gtest_add_tests(TARGET aedile_test) @@ -33,7 +33,9 @@ The SDK aims to support Linux, Windows, and macOS build targets. It currently s To build the SDK on Linux, run the following commands from the project root: ```bash -cmake --build --preset linux +export VCPKG_ROOT=/path/to/vcpkg/installation +cmake --preset=linux # configuration step +cmake --build build/linux # compilation or build step ``` To run unit tests, use the following command: |