--- cmake/CMakeLists.txt.orig	2015-04-19 21:57:16.000000000 +0000
+++ cmake/CMakeLists.txt	2016-10-04 14:43:18.859197000 +0000
@@ -37,12 +37,14 @@
 
 endmacro(GET_RELATIVE_SOURCES)
 
+if (BUILD_LIB)
 get_absolute_sources(abs_dcpp_sources "${DCPP_SRCS};${DCPP_HDRS}")
 get_relative_sources(rel_dcpp_sources "${dcpp_SOURCE_DIR}/po" "${abs_dcpp_sources}")
 file(MAKE_DIRECTORY "${dcpp_BINARY_DIR}/po")
 set(dcpp_files_from "${dcpp_BINARY_DIR}/po/libeiskaltdcpp_srcs.txt")
 string(REGEX REPLACE ";" "\n" dcpp_contents "${rel_dcpp_sources}")
 file(WRITE "${dcpp_files_from}" "${dcpp_contents}")
+endif (BUILD_LIB)
 
 if (USE_GTK OR USE_GTK3)
 get_absolute_sources(abs_gtk_cpp_sources "${GTK_SRCS};${GTK_HDRS}")
@@ -163,6 +165,7 @@
 			# if the po file doesn't exist. The case where a po file used to
 			# exist and no longer exists should never occur
 
+			if (BUILD_LIB)
 			if(NOT EXISTS ${dcpp_SOURCE_DIR}/po/${LANG}.po)
 				add_custom_command(
 					OUTPUT ${dcpp_SOURCE_DIR}/po/${LANG}.po
@@ -194,6 +197,7 @@
 				WORKING_DIRECTORY ${dcpp_SOURCE_DIR}/po
 				COMMENT "pot-update {dcpp-${LANG}}: Updated po file."
 			)
+			endif (BUILD_LIB)
 
 			if (USE_GTK OR USE_GTK3)
 			if(NOT EXISTS ${eiskaltdcpp-gtk_SOURCE_DIR}/po/${LANG}.po)
@@ -231,15 +235,19 @@
 			SET(pot-update-SRC ${pot-update-SRC} ${eiskaltdcpp-gtk_SOURCE_DIR}/po/${LANG}.po.dummy )
 			endif (USE_GTK OR USE_GTK3)
 
+			if (BUILD_LIB)
 			SET(pot-update-SRC ${pot-update-SRC} ${dcpp_SOURCE_DIR}/po/${LANG}.po.dummy)
+			endif (BUILD_LIB)
 		endforeach(LANG ${LANGUAGES})
 
 		# Add to target list
+		if (BUILD_LIB)
 		SET(pot-update-SRC
 			${pot-update-SRC}
 			${dcpp_SOURCE_DIR}/po/libeiskaltdcpp.pot # should depend on languages
 
 		)
+		endif (BUILD_LIB)
 		if (USE_GTK OR USE_GTK3)
 		SET(pot-update-SRC
 			${pot-update-SRC}
@@ -329,6 +337,7 @@
 
 	foreach(LANG ${LANGUAGES})
 
+		if (BUILD_LIB)
 			add_custom_command(
 				OUTPUT ${dcpp_BINARY_DIR}/${LANG}_libeiskaltdcpp.mo
 				COMMAND ${GETTEXT_MSGFMT_EXECUTABLE}
@@ -339,6 +348,7 @@
 				WORKING_DIRECTORY ${dcpp_SOURCE_DIR}/po
 				COMMENT "Creating mo file ${dcpp_BINARY_DIR}/${LANG}_libeiskaltdcpp.mo"
 			)
+			endif (BUILD_LIB)
 			if (USE_GTK OR USE_GTK3)
 
 			add_custom_command(
@@ -360,12 +370,14 @@
 			)
 			endif (USE_GTK OR USE_GTK3)
 
+			if (BUILD_LIB)
 			list(APPEND mo-update-SRC
 				${dcpp_BINARY_DIR}/${LANG}_libeiskaltdcpp.mo
 			)
 			list(APPEND mo-update-LANG-SRC
 				${dcpp_BINARY_DIR}/${LANG}_libeiskaltdcpp.mo
 			)
+			endif (BUILD_LIB)
 
 		if(UPDATE_PO)
 			add_custom_target(mo-update-${LANG}
