diff options
author | Erik Kundiman <erik@megapahit.org> | 2023-07-11 08:22:43 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2023-07-19 10:21:19 +0800 |
commit | f0851a025deaaa8636cde6ee8339529eb6322d3d (patch) | |
tree | d83aea396c8524368de9cae5c722096980a1bfd4 | |
parent | ec4135da63a3f3877222fba4ecb59b15650371fe (diff) |
Set CMake USESYSTEMLIBS on to use system libraries
Its use_system_binary implementation first tries to use pkg-config to
generate the necessary flags. But if it doesn't find the package, then
it will try to use find_package.
The USESYSTEMLIBS is also brought back again though only in 1 place, and
the name because it's the one still on the wiki page (the building the
viewer with Autobuild one), so the CMake variable is not totally new.
-rw-r--r-- | indra/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/cmake/Prebuilt.cmake | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 205ce402a0..52e6749c72 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -24,6 +24,10 @@ if( USE_CONAN ) set( USE_AUTOBUILD_3P OFF ) conan_basic_setup(TARGETS NO_OUTPUT_DIRS) add_compile_definitions(LL_USESYSTEMLIBS USE_CONAN NO_AUTOBUILD_3P) +elseif( USESYSTEMLIBS ) + set( USE_CONAN OFF ) + set( USE_AUTOBUILD_3P OFF ) + add_compile_definitions(LL_USESYSTEMLIBS) else() set( USE_CONAN OFF ) set( USE_AUTOBUILD_3P ON ) diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index 634cc15c21..b0acae279b 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -67,6 +67,22 @@ macro ( use_system_binary package ) endif() endforeach() return() + elseif( NOT USE_AUTOBUILD_3P ) + include(FindPkgConfig) + pkg_check_modules(${package} ${package}) + if( ${package}_FOUND ) + target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) + else() + pkg_check_modules(${package} lib${package}) + if( ${package}_FOUND ) + target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) + else() + find_package( ${package} REQUIRED ) + endif() + endif() + target_include_directories( ll::${package} SYSTEM INTERFACE ${${package}_INCLUDE_DIRS} ) + target_link_libraries( ll::${package} INTERFACE ${${package}_LIBRARIES} ) + return() endif() endmacro() |