diff dep/animia/CMakeLists.txt @ 201:8f6f8dd2eb23

dep/animia: finish kvm backend dep/animia: cmake: don't use kvm on unsupported systems, use private and public includes properly cmake: why are we defining target include directories twice?
author paper@DavesDouble.local
date Sun, 19 Nov 2023 19:13:28 -0500
parents e44b7c428d7c
children 71832ffe425a
line wrap: on
line diff
--- a/dep/animia/CMakeLists.txt	Sun Nov 19 17:30:38 2023 -0500
+++ b/dep/animia/CMakeLists.txt	Sun Nov 19 19:13:28 2023 -0500
@@ -73,16 +73,15 @@
 			list(APPEND DEFINES LIBUTIL)
 			list(APPEND SRC_FILES src/fd/libutil.cc)
 		endif() # LIBUTIL_GOOD
-	elseif(LIBKVM_LIBRARY) # BSD libkvm
-		get_filename_component(LIBKVM_DIR ${LIBKVM_LIBRARY} DIRECTORY)
+	elseif(LIBKVM_LIBRARY) # OpenBSD kvm
+		include(CheckSymbolExists)
+		# Check if we can get open files by PID
+		check_symbol_exists(KERN_FILE_BYPID "kvm.h" HAVE_BYPID)
 
-		include(CheckLibraryExists)
-		check_library_exists(kvm kvm_getprocs ${LIBKVM_DIR} LIBKVM_GOOD)
-
-		if(LIBKVM_GOOD)
+		if(HAVE_BYPID)
 			list(APPEND LIBRARIES ${LIBKVM_LIBRARY})
 			list(APPEND DEFINES LIBKVM)
-			list(APPEND SRC_FILES src/fd/libkvm.cc)
+			list(APPEND SRC_FILES src/fd/kvm.cc)
 		endif() # LIBUTIL_GOOD
 	endif() # LINUX
 
@@ -128,5 +127,5 @@
 )
 
 target_compile_definitions(animia PUBLIC ${DEFINES})
-target_include_directories(animia PRIVATE include PUBLIC ${INCLUDE_DIRS})
+target_include_directories(animia PUBLIC include PRIVATE ${INCLUDE_DIRS})
 target_link_libraries(animia PUBLIC ${LIBRARIES})