diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d9b0944e0..99c22bda33 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -188,8 +188,13 @@ if( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
     add_definitions(-Wall -Wextra)
 endif()

+# this needs to be here because also code in shared/ needs config.h. This is also the
+# reason why various checks are above why they belong under if( WITH_PLAYER )
+configure_file( shared/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/shared/config.h )
+
 add_subdirectory( data )
 add_subdirectory( images )
+add_subdirectory( shared )

 if( WITH_PLAYER )
     find_package(X11)
@@ -309,12 +314,6 @@ if( WITH_PLAYER )

 endif()

-# this needs to be here because also code in shared/ needs config.h. This is also the
-# reason why various checks are above why they belong under if( WITH_PLAYER )
-configure_file( shared/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/shared/config.h )
-
-add_subdirectory( shared )
-
 if( WITH_UTILITIES )
     add_subdirectory( utilities )
 endif()
