From 51df05c7d15c67e7ce504bf7491612c18abdf91a Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sat, 23 Mar 2024 16:59:35 +0100 Subject: [PATCH] CMake: Allow compiling against system libraries for cryptopp and libunwind --- CMakeLists.txt | 14 ++++++++++++-- README.md | 2 ++ tools/3dsx_to_cia/CMakeLists.txt | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b2830..9b29763 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,13 @@ find_package(SDL2 REQUIRED) find_package(spdlog REQUIRED) -find_package(cryptopp REQUIRED) +include(FindPkgConfig) + +find_package(cryptopp) +if (NOT cryptopp_FOUND) + pkg_search_module(cryptopp REQUIRED IMPORTED_TARGET cryptopp libcryptopp) + add_library(cryptopp::cryptopp ALIAS PkgConfig::cryptopp) +endif() find_package(Pistache) if (Pistache_FOUND) @@ -72,7 +78,11 @@ find_package(glslang REQUIRED) #set_property(TARGET proj PROPERTY CXX_STANDARD_REQUIRED ON) if(NOT ANDROID) - find_package(libunwind REQUIRED) + find_package(libunwind) + if (NOT libunwind_FOUND) + pkg_search_module(libunwind IMPORTED_TARGET libunwind) + add_library(libunwind::unwind ALIAS PkgConfig::libunwind) + endif() endif () # TODO: find_package-ify diff --git a/README.md b/README.md index fb8b965..164d014 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,11 @@ via Conan. To enable this behavior, add the following to your Conan profile ``` [platform_requires] boost/1.80.0 +cryptopp/8.5.0 sdl/2.0.20 range-v3/0.11.0 catch2/2.13.7 +libunwind/1.8.0 ``` ## Usage diff --git a/tools/3dsx_to_cia/CMakeLists.txt b/tools/3dsx_to_cia/CMakeLists.txt index f3fb7da..ca0c46f 100644 --- a/tools/3dsx_to_cia/CMakeLists.txt +++ b/tools/3dsx_to_cia/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(3dsx_to_cia main.cpp) -target_link_libraries(3dsx_to_cia PRIVATE framework platform cryptopp-static Boost::boost Boost::program_options) +target_link_libraries(3dsx_to_cia PRIVATE framework platform cryptopp::cryptopp Boost::boost Boost::program_options)