CMake: Allow compiling against system libraries for cryptopp and libunwind

This commit is contained in:
Tony Wasserka 2024-03-23 16:59:35 +01:00
parent e659f69635
commit 51df05c7d1
3 changed files with 15 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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)