diff --git a/cmake/platforms/Win32.cmake b/cmake/platforms/Win32.cmake
index 3573f947e4..9c2d658675 100644
--- a/cmake/platforms/Win32.cmake
+++ b/cmake/platforms/Win32.cmake
@@ -1,20 +1,20 @@
 # Copyright (c) 2017 The Bitcoin developers
 
 set(CMAKE_SYSTEM_NAME Windows)
 set(TOOLCHAIN_PREFIX i686-w64-mingw32)
 
 # cross compilers to use for C and C++
 set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
 set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
 set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
 
 # target environment on the build host system
 #   set 1st to dir with the cross compiler's C/C++ headers/libs
-set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};/usr/${TOOLCHAIN_PREFIX}")
 
 # modify default behavior of FIND_XXX() commands to
 # search for headers/libs in the target environment and
 # search for programs in the build host environment
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/platforms/Win64.cmake b/cmake/platforms/Win64.cmake
index c3a121f40c..ea58932d0b 100644
--- a/cmake/platforms/Win64.cmake
+++ b/cmake/platforms/Win64.cmake
@@ -1,20 +1,20 @@
 # Copyright (c) 2017 The Bitcoin developers
 
 set(CMAKE_SYSTEM_NAME Windows)
 set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
 
 # cross compilers to use for C and C++
 set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
 set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
 set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
 
 # target environment on the build host system
 #   set 1st to dir with the cross compiler's C/C++ headers/libs
-set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};/usr/${TOOLCHAIN_PREFIX}")
 
 # modify default behavior of FIND_XXX() commands to
 # search for headers/libs in the target environment and
 # search for programs in the build host environment
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ec32dd52cf..f2c84a5164 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,68 @@
 # Copyright (c) 2017 The Bitcoin developers
 
+set(CMAKE_CXX_STANDARD 11)
+
 add_subdirectory(config)
 add_subdirectory(crypto)
 add_subdirectory(leveldb)
 add_subdirectory(secp256k1)
 add_subdirectory(univalue)
+
+# Because the Bitcoin ABc source code is disorganised, we
+# end up with a bunch of libraries without any aparent
+# cohesive structure. This is inherited from Bitcoin Core
+# and reflecting this.
+# TODO: Improve the structure once cmake is rocking.
+
+# Various completely unrelated features shared by all executables.
+add_library(util
+	chainparamsbase.cpp
+	clientversion.cpp
+	compat/glibc_sanity.cpp
+	compat/glibcxx_sanity.cpp
+	compat/strnlen.cpp
+	random.cpp
+	rpc/protocol.cpp
+	support/cleanse.cpp
+	support/lockedpool.cpp
+	sync.cpp
+	threadinterrupt.cpp
+	uint256.cpp
+	util.cpp
+	utilmoneystr.cpp
+	utilstrencodings.cpp
+	utiltime.cpp
+)
+
+target_compile_definitions(util PUBLIC HAVE_CONFIG_H)
+target_include_directories(util
+	PUBLIC
+		.
+		# To access the config.
+		# TODO: Make compat its own lib and just import it.
+		${CMAKE_CURRENT_BINARY_DIR}
+		${CMAKE_CURRENT_BINARY_DIR}/config
+)
+
+# Dependencies
+set(BOOST_PACKAGES_REQUIRED filesystem)
+
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+	set(Boost_USE_STATIC_LIBS ON)
+	list(APPEND BOOST_PACKAGES_REQUIRED thread_win32)
+else()
+	list(APPEND BOOST_PACKAGES_REQUIRED date_time thread)
+endif()
+
+function(prepend var prefix)
+   set(listVar "")
+   foreach(f ${ARGN})
+      list(APPEND listVar "${prefix}${f}")
+   endforeach(f)
+   set(${var} "${listVar}" PARENT_SCOPE)
+endfunction(prepend)
+
+prepend(BOOST_LIBRARIES "Boost::" ${BOOST_PACKAGES_REQUIRED})
+
+find_package(Boost 1.55 REQUIRED ${BOOST_PACKAGES_REQUIRED})
+target_link_libraries(util univalue ${BOOST_LIBRARIES})
diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt
index 0603dd91ee..8dd799510c 100644
--- a/src/config/CMakeLists.txt
+++ b/src/config/CMakeLists.txt
@@ -1,49 +1,62 @@
 # Copyright (c) 2017 The Bitcoin developers
 
 # This generates config.h which provides numerous defines
 # about the state of the plateform we are building on.
 
 include(CheckIncludeFiles)
 include(CheckSymbolExists)
 
+# Version
+set(CLIENT_VERSION_MAJOR 0)
+set(CLIENT_VERSION_MINOR 16)
+set(CLIENT_VERSION_REVISION 2)
+set(CLIENT_VERSION_BUILD 0)
+
+# Copyright
+set(COPYRIGHT_YEAR 2017)
+set(COPYRIGHT_HOLDERS "The %s developers")
+set(COPYRIGHT_HOLDERS_SUBSTITUTION Bitcoin)
+
 # Endianness
 check_include_files("endian.h" HAVE_ENDIAN_H)
 check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H)
 
 if(HAVE_ENDIAN_H)
 	set(ENDIAN_FILE "endian.h")
 elseif(HAVE_SYS_ENDIAN_H)
 	set(ENDIAN_FILE "sys/endian.h")
 else()
 endif()
 
 if(ENDIAN_FILE)
 	check_symbol_exists(htole16 ${ENDIAN_FILE} HAVE_DECL_HTOLE16)
 	check_symbol_exists(htobe16 ${ENDIAN_FILE} HAVE_DECL_HTOBE16)
 	check_symbol_exists(be16toh ${ENDIAN_FILE} HAVE_DECL_BE16TOH)
 	check_symbol_exists(le16toh ${ENDIAN_FILE} HAVE_DECL_LE16TOH)
 	check_symbol_exists(htobe32 ${ENDIAN_FILE} HAVE_DECL_HTOBE32)
 	check_symbol_exists(htole32 ${ENDIAN_FILE} HAVE_DECL_HTOLE32)
 	check_symbol_exists(be32toh ${ENDIAN_FILE} HAVE_DECL_BE32TOH)
 	check_symbol_exists(le32toh ${ENDIAN_FILE} HAVE_DECL_LE32TOH)
 	check_symbol_exists(htobe64 ${ENDIAN_FILE} HAVE_DECL_HTOBE64)
 	check_symbol_exists(htole64 ${ENDIAN_FILE} HAVE_DECL_HTOLE64)
 	check_symbol_exists(be64toh ${ENDIAN_FILE} HAVE_DECL_BE64TOH)
 	check_symbol_exists(le64toh ${ENDIAN_FILE} HAVE_DECL_LE64TOH)
 endif()
 
 # Byte swap
 check_include_files("byteswap.h" HAVE_BYTESWAP_H)
 
 check_symbol_exists(bswap_16 "byteswap.h" HAVE_DECL_BSWAP_16)
 check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32)
 check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64)
 
 # Bitmanip intrinsics
 check_symbol_exists(__builtin_clz "" HAVE_DECL___BUILTIN_CLZ)
 check_symbol_exists(__builtin_clzl "" HAVE_DECL___BUILTIN_CLZL)
 check_symbol_exists(__builtin_clzll "" HAVE_DECL___BUILTIN_CLZLL)
 
+# Various system libraries
+check_symbol_exists(strnlen "string.h" HAVE_DECL_STRNLEN)
 
 # Generate the config
-configure_file(bitcoin-config.h.cmake.in bitcoin-config.h)
+configure_file(bitcoin-config.h.cmake.in bitcoin-config.h ESCAPE_QUOTES)
diff --git a/src/config/bitcoin-config.h.cmake.in b/src/config/bitcoin-config.h.cmake.in
index 69ffbf08b3..c47aaf3352 100644
--- a/src/config/bitcoin-config.h.cmake.in
+++ b/src/config/bitcoin-config.h.cmake.in
@@ -1,32 +1,43 @@
 // Copyright (c) 2017 The Bitcoin developers
 
 #ifndef BITCOIN_CONFIG_BITCOIN_CONFIG_H
 #define BITCOIN_CONFIG_BITCOIN_CONFIG_H
 
+#define CLIENT_VERSION_MAJOR ${CLIENT_VERSION_MAJOR}
+#define CLIENT_VERSION_MINOR ${CLIENT_VERSION_MINOR}
+#define CLIENT_VERSION_REVISION ${CLIENT_VERSION_REVISION}
+#define CLIENT_VERSION_BUILD ${CLIENT_VERSION_BUILD}
+
+#define COPYRIGHT_YEAR "${COPYRIGHT_YEAR}"
+#define COPYRIGHT_HOLDERS "${COPYRIGHT_HOLDERS}"
+#define COPYRIGHT_HOLDERS_SUBSTITUTION "${COPYRIGHT_HOLDERS_SUBSTITUTION}"
+
 #cmakedefine HAVE_ENDIAN_H @HAVE_ENDIAN_H@
 #cmakedefine HAVE_SYS_ENDIAN_H @HAVE_SYS_ENDIAN_H@
 
 #cmakedefine HAVE_DECL_HTOLE16 @HAVE_DECL_HTOLE16@
 #cmakedefine HAVE_DECL_HTOBE16 @HAVE_DECL_HTOBE16@
 #cmakedefine HAVE_DECL_BE16TOH @HAVE_DECL_BE16TOH@
 #cmakedefine HAVE_DECL_LE16TOH @HAVE_DECL_LE16TOH@
 #cmakedefine HAVE_DECL_HTOBE32 @HAVE_DECL_HTOBE32@
 #cmakedefine HAVE_DECL_HTOLE32 @HAVE_DECL_HTOLE32@
 #cmakedefine HAVE_DECL_BE32TOH @HAVE_DECL_BE32TOH@
 #cmakedefine HAVE_DECL_LE32TOH @HAVE_DECL_LE32TOH@
 #cmakedefine HAVE_DECL_HTOBE64 @HAVE_DECL_HTOBE64@
 #cmakedefine HAVE_DECL_HTOLE64 @HAVE_DECL_HTOLE64@
 #cmakedefine HAVE_DECL_BE64TOH @HAVE_DECL_BE64TOH@
 #cmakedefine HAVE_DECL_LE64TOH @HAVE_DECL_LE64TOH@
 
 #cmakedefine HAVE_BYTESWAP_H @HAVE_BYTESWAP_H@
 
 #cmakedefine HAVE_DECL_BSWAP_16 @HAVE_DECL_BSWAP_16@
 #cmakedefine HAVE_DECL_BSWAP_32 @HAVE_DECL_BSWAP_32@
 #cmakedefine HAVE_DECL_BSWAP_64 @HAVE_DECL_BSWAP_64@
 
 #cmakedefine HAVE_DECL___BUILTIN_CLZ @HAVE_DECL___BUILTIN_CLZ@
 #cmakedefine HAVE_DECL___BUILTIN_CLZL @HAVE_DECL___BUILTIN_CLZL@
 #cmakedefine HAVE_DECL___BUILTIN_CLZLL @HAVE_DECL___BUILTIN_CLZLL@
 
+#cmakedefine HAVE_DECL_STRNLEN @HAVE_DECL_STRNLEN@
+
 #endif // BITCOIN_BITCOIN_CONFIG_H