$OpenBSD: patch-lib_CMakeLists_txt,v 1.22 2018/09/27 21:49:32 sebastia Exp $

- Override library version
- only include utmpx_file when there is utmpx.h on the system

Index: lib/CMakeLists.txt
--- lib/CMakeLists.txt.orig
+++ lib/CMakeLists.txt
@@ -91,13 +91,16 @@ if (UNIX)
         "src/facts/posix/cache.cc"
         "src/util/posix/scoped_addrinfo.cc"
         "src/util/posix/scoped_descriptor.cc"
-        "src/util/posix/utmpx_file.cc"
         "src/util/config/posix/config.cc"
     )
     if (OPENSSL_FOUND)
         set(LIBFACTER_STANDARD_SOURCES ${LIBFACTER_STANDARD_SOURCES} "src/util/posix/scoped_bio.cc")
     endif()
 
+    if (HAVE_UTMPX_H)
+        set(LIBFACTER_STANDARD_SOURCES ${LIBFACTER_STANDARD_SOURCES} "src/util/posix/utmpx_file.cc")
+    endif()
+
     if (NOT AIX)
         set(LIBFACTER_STANDARD_SOURCES
             ${LIBFACTER_STANDARD_SOURCES}
@@ -330,6 +333,7 @@ set_target_properties(libfactersrc PROPERTIES POSITION
 add_library(libfacter $<TARGET_OBJECTS:libfactersrc>)
 if (BUILD_SHARED_LIBS)
     set_target_properties(libfacter PROPERTIES PREFIX "" SUFFIX ".so" IMPORT_PREFIX "" IMPORT_SUFFIX ".so.a" VERSION ${PROJECT_VERSION})
+    set_target_properties(libfacter PROPERTIES PREFIX "" SUFFIX ".so" IMPORT_PREFIX "" IMPORT_SUFFIX ".so.a" VERSION ${LIBfacter_VERSION})
 endif()
 
 if(AIX)
