File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,12 +4,37 @@ project(ncrypto VERSION 1.0.1)
44include (CTest )
55include (GNUInstallDirs )
66
7- find_package (OpenSSL REQUIRED )
7+ if (NCRYPTO_SHARED_LIBS)
8+ find_package (OpenSSL REQUIRED )
9+ else ()
10+ include (FetchContent )
11+ include (cmake/CPM.cmake )
12+
13+ CPMAddPackage (
14+ NAME boringssl
15+ VERSION 0.20250818.0
16+ GITHUB_REPOSITORY google/boringssl
17+ GIT_TAG 0.20250818.0
18+ OPTIONS "BUILD_SHARED_LIBS OFF" "BUILD_TESTING OFF"
19+ )
20+ endif ()
21+
822add_subdirectory (src )
923add_library (ncrypto::ncrypto ALIAS ncrypto )
1024
1125if (NCRYPTO_TESTING)
12- find_package (GTest REQUIRED )
26+ if (NCRYPTO_SHARED_LIBS)
27+ find_package (GTest REQUIRED )
28+ else ()
29+ CPMAddPackage (
30+ NAME GTest
31+ GITHUB_REPOSITORY google/googletest
32+ VERSION 1.15.2
33+ OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF"
34+ )
35+ # For Windows: Prevent overriding the parent project's compiler/linker settings
36+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
37+ endif ()
1338 enable_testing ()
1439 add_subdirectory (tests )
1540endif ()
Original file line number Diff line number Diff line change 11option (NCRYPTO_DEVELOPMENT_CHECKS "development checks (useful for debugging)" OFF )
22option (NCRYPTO_TESTING "Build tests" ON )
3+ option (NCRYPTO_SHARED_LIBS "Build (and test) using shared library" OFF )
34option (NCRYPTO_BSSL_LIBDECREPIT_MISSING "enable if boringssl is built without libdecrepit" OFF )
45
56set (CMAKE_POSITION_INDEPENDENT_CODE ON )
You can’t perform that action at this time.
0 commit comments