[lldb] [unittests] Filter FreeBSD through CMake rather than #ifdef
authorMichał Górny <mgorny@moritz.systems>
Thu, 17 Dec 2020 12:54:59 +0000 (13:54 +0100)
committerMichał Górny <mgorny@moritz.systems>
Thu, 17 Dec 2020 12:55:42 +0000 (13:55 +0100)
lldb/unittests/Process/Utility/CMakeLists.txt
lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp

index 8e4696b..772e781 100644 (file)
@@ -1,17 +1,21 @@
+set(FREEBSD_SOURCES
+  RegisterContextFreeBSDTest.cpp)
 set(NETBSD_SOURCES
   RegisterContextNetBSDTest_i386.cpp
   RegisterContextNetBSDTest_x86_64.cpp)
 
-if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  list(APPEND PLATFORM_SOURCES ${FREEBSD_SOURCES})
+elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
   list(APPEND PLATFORM_SOURCES ${NETBSD_SOURCES})
 endif()
 
 set(LLVM_OPTIONAL_SOURCES
+  ${FREEBSD_SOURCES}
   ${NETBSD_SOURCES})
 
 add_lldb_unittest(ProcessUtilityTests
   RegisterContextTest.cpp
-  RegisterContextFreeBSDTest.cpp
   LinuxProcMapsTest.cpp
   ${PLATFORM_SOURCES}
 
index 7d875c9..fe516d5 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#if defined(__FreeBSD__)
-
 // clang-format off
 #include <sys/types.h>
 #include <machine/reg.h>
@@ -233,5 +231,3 @@ TEST(RegisterContextFreeBSDTest, i386) {
 }
 
 #endif // defined(__i386__) || defined(__x86_64__)
-
-#endif // defined(__FreeBSD__)