--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,11 +8,9 @@
 #   Xcode: builds universal binaries, uses SSE2 on i386 and Altivec on ppc
 #   Unix and VS: SSE2 support is enabled by default
 #    use BUILD_SQUISH_WITH_SSE2 and BUILD_SQUISH_WITH_ALTIVEC to override
-
+CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
 PROJECT(squish)
 
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
-
 OPTION(BUILD_SQUISH_WITH_OPENMP "Build with OpenMP." ON)
 
 OPTION(BUILD_SQUISH_WITH_SSE2 "Build with SSE2." ON)
@@ -22,26 +20,6 @@ OPTION(BUILD_SHARED_LIBS "Build shared libraries." OFF)
 
 OPTION(BUILD_SQUISH_EXTRA "Build extra source code." OFF)
 
-IF (BUILD_SQUISH_WITH_OPENMP)
-   FIND_PACKAGE(OpenMP)
-   IF (OPENMP_FOUND)
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-       ADD_DEFINITIONS(-DSQUISH_USE_OPENMP)
-   ENDIF()
-ENDIF()
-
-IF (CMAKE_GENERATOR STREQUAL "Xcode")
-    SET(CMAKE_OSX_ARCHITECTURES "i386;ppc")
-ELSE (CMAKE_GENERATOR STREQUAL "Xcode")
-    IF (BUILD_SQUISH_WITH_SSE2 AND NOT WIN32)
-        ADD_DEFINITIONS(-DSQUISH_USE_SSE=2 -msse2)
-    ENDIF (BUILD_SQUISH_WITH_SSE2 AND NOT WIN32)
-    IF (BUILD_SQUISH_WITH_ALTIVEC AND NOT WIN32)
-        ADD_DEFINITIONS(-DSQUISH_USE_ALTIVEC=1 -maltivec)
-    ENDIF (BUILD_SQUISH_WITH_ALTIVEC AND NOT WIN32)
-ENDIF (CMAKE_GENERATOR STREQUAL "Xcode")
-
 SET(SQUISH_HDRS
     squish.h
     )
@@ -75,18 +53,41 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
 ADD_LIBRARY(squish ${SQUISH_SRCS} ${SQUISH_HDRS})
 
+IF(BUILD_SQUISH_WITH_OPENMP)
+    IF(NOT TARGET OpenMP::OpenMP_CXX)
+        FIND_PACKAGE(Threads REQUIRED)
+        ADD_LIBRARY(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
+        SET_PROPERTY(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
+        SET_PROPERTY(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
+    ENDIF()
+    TARGET_LINK_LIBRARIES(squish PRIVATE OpenMP::OpenMP_CXX)
+    TARGET_COMPILE_DEFINITIONS(squish PRIVATE "SQUISH_USE_OPENMP")
+ENDIF()
+
+IF(BUILD_SQUISH_WITH_SSE2)
+    TARGET_COMPILE_DEFINITIONS(squish PRIVATE "SQUISH_USE_SSE=2")
+    IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
+       "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
+       "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+        TARGET_COMPILE_OPTIONS(squish PRIVATE -msse2)
+    ENDIF()
+ENDIF()
+
+IF(BUILD_SQUISH_WITH_ALTIVEC)
+    TARGET_COMPILE_DEFINITIONS(squish PRIVATE "SQUISH_USE_ALTIVEC=1")
+    IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
+       "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
+       "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+        TARGET_COMPILE_OPTIONS(squish PRIVATE -maltivec)
+    ENDIF()
+ENDIF()
+
 SET_TARGET_PROPERTIES(
     squish PROPERTIES
     PUBLIC_HEADER "${SQUISH_HDRS}"
     VERSION 0.0
     SOVERSION 0.0
     DEBUG_POSTFIX "d"
-    XCODE_ATTRIBUTE_GCC_PREPROCESSOR_DEFINITIONS "$(SQUISH_CPP_$(CURRENT_ARCH))"
-    XCODE_ATTRIBUTE_OTHER_CFLAGS "$(SQUISH_CFLAGS_$(CURRENT_ARCH))"
-    XCODE_ATTRIBUTE_SQUISH_CPP_i386 "SQUISH_USE_SSE=2"
-    XCODE_ATTRIBUTE_SQUISH_CFLAGS_i386 ""
-    XCODE_ATTRIBUTE_SQUISH_CPP_ppc "SQUISH_USE_ALTIVEC=1"
-    XCODE_ATTRIBUTE_SQUISH_CFLAGS_ppc "-maltivec"
     )
 
 IF (BUILD_SQUISH_EXTRA)
@@ -113,5 +114,6 @@ INSTALL(
     TARGETS squish
     LIBRARY DESTINATION lib
     ARCHIVE DESTINATION lib
+    RUNTIME DESTINATION bin
     PUBLIC_HEADER DESTINATION include
     )
