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 /indra/cmake | |
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.
Diffstat (limited to 'indra/cmake')
-rw-r--r-- | indra/cmake/Prebuilt.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
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() |