--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -280,13 +280,6 @@ endif( FMOD_LIBRARY )
 
 # Search for NASM
 
-if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
-	if( NOT NO_ASM )
-		message( STATUS "Disabling assembly code for PowerPC." )
-		set( NO_ASM ON )
-	endif( NOT NO_ASM )
-endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
-
 if( NOT NO_ASM )
 	if( UNIX AND X64 )
 		find_program( GAS_PATH as )
@@ -375,6 +368,41 @@ if( NOT NO_ASM )
 	ENDMACRO( ADD_ASM_FILE )
 endif( NOT NO_ASM )
 
+# Decide on SSE setup
+
+set( SSE_MATTERS NO )
+
+# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it.
+if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
+	CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH )
+	CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 )
+	if( CAN_DO_MFPMATH )
+		set( SSE1_ENABLE "-msse -mfpmath=sse" )
+		set( SSE2_ENABLE "-msse2 -mfpmath=sse" )
+		set( SSE_MATTERS YES )
+	elseif( CAN_DO_ARCHSSE2 )
+		set( SSE1_ENABLE -arch:SSE )
+		set( SSE2_ENABLE -arch:SSE2 )
+		set( SSE_MATTERS YES )
+	endif( CAN_DO_MFPMATH )
+endif( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc )
+
+if( SSE_MATTERS )
+	if( WIN32 )
+		set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
+	else( WIN32 )
+		CHECK_FUNCTION_EXISTS(mprotect HAVE_MPROTECT)
+		if( HAVE_MPROTECT )
+			set( BACKPATCH 1 CACHE BOOL "Enable backpatching." )
+		else( HAVE_MPROTECT )
+			set( BACKPATCH 0 )
+		endif( HAVE_MPROTECT )
+	endif( WIN32 )
+	set( SSE 1 CACHE BOOL "Build SSE and SSE2 versions of key code." )
+else( SSE_MATTERS )
+	set( BACKPATCH 0 )
+endif( SSE_MATTERS )
+
 # Set up flags for GCC
 
 if( CMAKE_COMPILER_IS_GNUCXX )
@@ -565,13 +593,6 @@ add_custom_command( OUTPUT ${CMAKE_CURRE
 
 include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
 
-if( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
-	set( X86_SOURCES )
-	set( NOT_X86 ON )
-else( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
-	set( X86_SOURCES nodebuild_classify_sse2.cpp )
-endif( CMAKE_SYSTEM_PROCESSOR MATCHES powerpc )
-
 # [BB] Only complile the gl sources, if we want GL support.
 if( NOT NO_GL )
 	set( GL_SOURCES
@@ -620,6 +641,17 @@ else( NOT NO_GL )
 	set( GL_SOURCES sdl/glstubs.cpp )
 endif( NOT NO_GL )
 
+if( SSE_MATTERS )
+	if( SSE )
+		set( X86_SOURCES nodebuild_classify_sse2.cpp )
+		set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "${SSE2_ENABLE}" )
+	else( SSE )
+		add_definitions( -DDISABLE_SSE )
+	endif( SSE )
+else( SSE_MATTERS )
+	add_definitions( -DDISABLE_SSE )
+	set( X86_SOURCES )
+endif( SSE_MATTERS )
 
 add_executable( zdoom WIN32
 	autostart.cpp
@@ -993,13 +1025,10 @@ if( CMAKE_COMPILER_IS_GNUCXX )
 	# GCC misoptimizes this file
 	set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" )
 	
-	# Compile this one file with SSE2 support.
-	set_source_files_properties( nodebuild_classify_sse2.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mfpmath=sse" )
-
 	# Need to enable intrinsics for this file.
-	if( NOT NOT_X86 )
+	if( SSE_MATTERS )
 		set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
-	endif( NOT NOT_X86 )
+	endif( SSE_MATTERS )
 endif( CMAKE_COMPILER_IS_GNUCXX )
 
 if( MSVC )
--- src/nodebuild.h
+++ src/nodebuild.h
@@ -272,19 +272,5 @@ inline int FNodeBuilder::PointOnSide (in
 
 inline int FNodeBuilder::ClassifyLine (node_t &node, const FPrivSeg *seg, int &sidev1, int &sidev2)
 {
-#if !defined(_M_IX86) && !defined(_M_X64) && !defined(__i386__) && !defined(__amd64__)
 	return ClassifyLine2 (node, seg, sidev1, sidev2);
-#elif defined(__SSE2__)
-	// If compiling with SSE2 support everywhere, just use the SSE2 version.
-	return ClassifyLineSSE2 (node, seg, sidev1, sidev2);
-#elif defined(_MSC_VER) && _MSC_VER < 1300
-	// VC 6 does not support SSE2 optimizations.
-	return ClassifyLine2 (node, seg, sidev1, sidev2);
-#else
-	// Select the routine based on our flag.
-	if (EnableSSE2)
-		return ClassifyLineSSE2 (node, seg, sidev1, sidev2);
-	else
-		return ClassifyLine2 (node, seg, sidev1, sidev2);
-#endif
 }
