From 7c4dbe7e35e4948158b898ea6724671dba50b70d Mon Sep 17 00:00:00 2001 From: Pete Savage Date: Sun, 25 Jul 2021 14:45:45 +0100 Subject: [PATCH] Added option to use system cxxopts --- cmake/SfizzDeps.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/SfizzDeps.cmake b/cmake/SfizzDeps.cmake index e5d14ca8..ea277a40 100644 --- a/cmake/SfizzDeps.cmake +++ b/cmake/SfizzDeps.cmake @@ -67,9 +67,19 @@ add_library(sfizz::jsl ALIAS sfizz_jsl) target_include_directories(sfizz_jsl INTERFACE "external/jsl/include") # The cxxopts library -add_library(sfizz_cxxopts INTERFACE) +if(SFIZZ_USE_SYSTEM_CXXOPTS) + find_path(CXXOPTS_INCLUDE_DIR "cxxopts.hpp") + if(NOT CXXOPTS_INCLUDE_DIR) + message(FATAL_ERROR "Cannot find cxxopts") + endif() + add_library(sfizz_cxxopts INTERFACE) + target_include_directories(sfizz_cxxopts INTERFACE "${CXXOPTS_INCLUDE_DIR}") +else() + add_library(sfizz_cxxopts INTERFACE) + add_library(sfizz::cxxopts ALIAS sfizz_cxxopts) + target_include_directories(sfizz_cxxopts INTERFACE "external/cxxopts") +endif() add_library(sfizz::cxxopts ALIAS sfizz_cxxopts) -target_include_directories(sfizz_cxxopts INTERFACE "external/cxxopts") # The sndfile library if(SFIZZ_USE_SNDFILE OR SFIZZ_DEMOS OR SFIZZ_DEVTOOLS OR SFIZZ_BENCHMARKS)