]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3731] Fix support for old log4cplus in Meson
authorAndrei Pavel <andrei@isc.org>
Thu, 6 Mar 2025 10:05:44 +0000 (12:05 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 13 Mar 2025 17:03:36 +0000 (18:03 +0100)
meson.build

index d610e17451a6e57dfed6bef09bc01d252e5c35de..1679b985c3adb7a74b7ec35cde9ca0b8fd445d26 100644 (file)
@@ -171,9 +171,15 @@ KEA_MSG_COMPILER = disabler()
 boost = dependency('boost', version: '>=1.66')
 threads = dependency('threads')
 add_project_dependencies(boost, threads, language: ['cpp'])
+
 gtest = dependency('gtest', required: false)
-log4cplus = dependency('log4cplus')
 
+# Logging
+log4cplus = dependency('log4cplus', required: false)
+# TODO: leave only dependecy() when support for Ubuntu 20.04 gets removed.
+if not log4cplus.found()
+    log4cplus = cpp.find_library('log4cplus')
+endif
 
 # Cryptography
 crypto = disabler()
@@ -665,14 +671,17 @@ elif crypto.name() == openssl.name()
         report_conf_data.set('CRYPTO_VERSION', openssl.version())
     endif
 endif
-report_conf_data.set(
-    'LOG4CPLUS_INCLUDE',
-    log4cplus.get_variable('includedir', default_value: 'unknown'),
-)
-report_conf_data.set(
-    'LOG4CPLUS_LIBDIR',
-    log4cplus.get_variable('libdir', default_value: 'unknown'),
-)
+# TODO: remove if-condition when support for Ubuntu 20.04 gets removed.
+if log4cplus.type_name() == 'pkgconfig'
+    report_conf_data.set(
+        'LOG4CPLUS_INCLUDE',
+        log4cplus.get_variable('includedir', default_value: 'unknown'),
+    )
+    report_conf_data.set(
+        'LOG4CPLUS_LIBDIR',
+        log4cplus.get_variable('libdir', default_value: 'unknown'),
+    )
+endif
 result = cpp.run(
     fs.read('compiler-checks/get-log4cplus-version.cc'),
     name: 'Get Log4cplus version',