Move -isystem hack inside if-found

This was breaking if we didn't find libzmq (or didn't find recent
enough) because the target didn't exist.
This commit is contained in:
Jason Rhinelander 2020-05-16 20:06:01 -03:00
parent e5a8d09127
commit e072e68d84
1 changed files with 10 additions and 9 deletions

View File

@ -47,6 +47,8 @@ if(TARGET libzmq)
elseif(BUILD_SHARED_LIBS)
include(FindPkgConfig)
pkg_check_modules(libzmq libzmq>=4.3 IMPORTED_TARGET)
if(libzmq_FOUND)
# Debian sid includes a -isystem in the mit-krb package that, starting with pkg-config 0.29.2,
# breaks cmake's pkgconfig module because it stupidly thinks "-isystem" is a path, so if we find
# -isystem in the include dirs then hack it out.
@ -57,7 +59,6 @@ elseif(BUILD_SHARED_LIBS)
set_property(TARGET PkgConfig::libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${zmq_inc})
endif()
if(libzmq_FOUND)
target_link_libraries(lokimq PUBLIC PkgConfig::libzmq)
else()
set(lokimq_build_static_libzmq ON)