diff --git a/CMakeLists.txt b/CMakeLists.txt
index d77de0c..338abb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,19 +8,8 @@ endif()
 # CMake on OSX likes to see this set explicitly, otherwise it outputs a warning.
 set(CMAKE_MACOSX_RPATH 1)
 
-if(NOT "${CMAKE_BUILD_TYPE}" MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
-  message(FATAL_ERROR "Please re-run CMake, specifying -DCMAKE_BUILD_TYPE=Debug , -DCMAKE_BUILD_TYPE=Release , -DCMAKE_BUILD_TYPE=RelWithDebInfo or -DCMAKE_BUILD_TYPE=MinSizeRel .")
-endif()
-
 option(BUILD_SHARED_LIBS "Build shared library" ON)
 
-# The Visual Studio CMake generators default to multiple configurations, but Fruit doesn't support multi-configuration build directories.
-set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}")
-
-if(NOT "${RUNTIME_OUTPUT_DIRECTORY}")
-  set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
-endif()
-
 set(FRUIT_ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX compiler flags." FORCE)
 
 set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_CXX_FLAGS}")
@@ -34,23 +23,24 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang|MSVC)$")
   #   - https://software.intel.com/en-us/forums/intel-c-compiler/topic/606049
 endif()
 
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang|Intel|AppleClang)$")
-  set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -std=c++11 -W -Wall -Wno-unknown-warning-option -Wno-missing-braces")
-elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$")
-  # TODO: we currently disable the warning C4709 because MSVC emits it even when there is no reason to. Re-enable it when possible.
-  # TODO: the warning C4141 is disabled, because MSVC emits it ("'inline': used more than once") when a function/method is marked with both __forceinline and inline.
-  # TODO: the warning C4714 is disabled, MSVC emits it when it decides not to inline a __forceinline function/method.
-  # The warning C4577 is disabled because we don't need a termination guarantee on exceptions for functions marked with
-  # 'noexcept'.
-  # The warning C4530 is disabled because it's triggered by MSVC's STL.
-  set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /D_SCL_SECURE_NO_WARNINGS")
-endif()
+set(FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces)
+set(FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -Wno-unknown-warning-option -Wno-missing-braces)
+set(FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces)
+set(FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces)
+set(FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC ${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /D_SCL_SECURE_NO_WARNINGS)
+
+list(APPEND FRUIT_ADDITIONAL_COMPILE_FLAGS
+  $<$<CXX_COMPILER_ID:GNU>:${FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU}>
+  $<$<CXX_COMPILER_ID:Clang>:${FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang}>
+  $<$<CXX_COMPILER_ID:Intel>:${FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel}>
+  $<$<CXX_COMPILER_ID:AppleClang>:${FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang}>
+  $<$<CXX_COMPILER_ID:MSVC>:${FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC}>)
 
 option(FRUIT_ENABLE_COVERAGE "Enable collection of test coverage. This is meant to be used by Fruit developers. It's only supported when using GCC on Linux." OFF)
 if("${FRUIT_ENABLE_COVERAGE}")
   # We also disable exceptions because otherwise GCC considers every function/method call that could throw as an
   # additional branch.
-  set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -fprofile-arcs -ftest-coverage -fno-exceptions -fno-inline -O0")
+  list(APPEND FRUIT_ADDITIONAL_COMPILE_FLAGS -fprofile-arcs -ftest-coverage -fno-exceptions -fno-inline -O0)
   set(FRUIT_ADDITIONAL_LINKER_FLAGS "${FRUIT_ADDITIONAL_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -fno-exceptions -fno-inline -O0")
 endif()
 
@@ -58,61 +48,27 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL
         "Whether to use Boost (specifically, boost::unordered_set and boost::unordered_map).
         If this is false, Fruit will use std::unordered_set and std::unordered_map instead (however this causes injection to be a bit slower).")
 
-if("${WIN32}" AND "${FRUIT_USES_BOOST}")
-  set(BOOST_DIR "" CACHE PATH "The directory where the boost library is installed, e.g. C:\\boost\\boost_1_62_0.")
-  if("${BOOST_DIR}" STREQUAL "")
-    message(FATAL_ERROR "Please re-run CMake, specifying the boost library path as BOOST_DIR, e.g. -DBOOST_DIR=C:\\boost\\boost_1_62_0, or specify -DFRUIT_USES_BOOST=False to not use boost.")
-  endif()
-  include_directories("${BOOST_DIR}")
-endif()
-
-set(RUN_TESTS_UNDER_VALGRIND FALSE CACHE BOOL "Whether to run Fruit tests under valgrind")
-if ("${RUN_TESTS_UNDER_VALGRIND}")
-  set(RUN_TESTS_UNDER_VALGRIND_FLAG "1")
-endif()
-
 # Unsafe, only for debugging/benchmarking.
 #set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -DFRUIT_NO_LOOP_CHECK=1")
 
-add_definitions(${FRUIT_ADDITIONAL_COMPILE_FLAGS})
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}")
 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}")
 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}")
-
-if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
-    set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}")
-else()
-    set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}")
-endif()
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
+set(FRUIT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include)
 
 # (debug-only) compile switch to get deep template instantiation stacktraces for errors (instead
 # of the user-friendly default that hides Fruit internals).
 #add_definitions(-DFRUIT_DEEP_TEMPLATE_INSTANTIATION_STACKTRACES_FOR_ERRORS=1)
 
-set(INSTALL_INCLUDE_DIR include/fruit CACHE PATH "Installation directory for headers")
-set(INSTALL_LIBRARY_DIR lib CACHE PATH "Installation directory for libraries")
+include(GNUInstallDirs)
 
 set(FRUIT_VERSION "3.4.0")
 
 add_subdirectory(configuration)
 add_subdirectory(src)
 
-if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
-  # Do not exclude these from "make all" in debug mode, they must build.
-  add_subdirectory(examples)
-  add_subdirectory(tests)
-else()
-  add_subdirectory(examples EXCLUDE_FROM_ALL)
-  add_subdirectory(tests)
-endif()
-
-add_subdirectory(extras EXCLUDE_FROM_ALL)
-
 install(DIRECTORY include/fruit/
-  DESTINATION "${INSTALL_INCLUDE_DIR}"
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit
   FILES_MATCHING PATTERN "*.h")
 
 set(CPACK_PACKAGE_NAME "Fruit")
diff --git a/configuration/CMakeLists.txt b/configuration/CMakeLists.txt
index b18a463..a78a5bb 100644
--- a/configuration/CMakeLists.txt
+++ b/configuration/CMakeLists.txt
@@ -1,7 +1,17 @@
 
 include(CheckCXXSourceCompiles)
 
-set(CMAKE_REQUIRED_FLAGS "${FRUIT_COMPILE_FLAGS}")
+if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+    set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU})
+elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^Clang$")
+    set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang})
+elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
+    set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel})
+elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
+    set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang})
+elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
+    set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC})
+endif()
 
 CHECK_CXX_SOURCE_COMPILES("
 int main() {}
@@ -218,4 +228,4 @@ endif()
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fruit-config-base.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/fruit/impl/fruit-config-base.h)
 
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../include/fruit/impl/fruit-config-base.h
-  DESTINATION ${INSTALL_INCLUDE_DIR}/impl)
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit/impl)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 66bf79f..9c75ec6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,16 +11,28 @@ normalized_component_storage_holder.cpp
 semistatic_map.cpp
 semistatic_graph.cpp)
 
-if("${BUILD_SHARED_LIBS}")
+if(BUILD_SHARED_LIBS)
     add_library(fruit SHARED ${FRUIT_SOURCES})
 
-    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
-        set_target_properties(fruit PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
-    endif()
+    set_target_properties(fruit PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
 else()
     add_library(fruit STATIC ${FRUIT_SOURCES})
 endif()
 
+target_include_directories(fruit
+    PUBLIC
+        ${FRUIT_INCLUDE_DIRS})
+target_compile_options(fruit
+    PUBLIC
+        ${FRUIT_ADDITIONAL_COMPILE_FLAGS})
+
+if(FRUIT_USES_BOOST)
+    target_include_directories(fruit
+        PRIVATE
+            ${CONAN_INCLUDE_DIRS_BOOST})
+endif()
+
 install(TARGETS fruit
-        ARCHIVE DESTINATION "${INSTALL_LIBRARY_DIR}"
-        LIBRARY DESTINATION "${INSTALL_LIBRARY_DIR}")
+        RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+        ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
