diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index 7fb343877..9a4c8f291 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -63,6 +63,7 @@ macro(add_credentials_module _name _sourcesvar _depsvar _defsvar _cflagsvar _inc
 endmacro(add_credentials_module)
 
 add_subdirectory(cache-reaper)
+add_subdirectory(nss-pkcs11)
 add_subdirectory(google-backend)
 add_subdirectory(outlook-backend)
 add_subdirectory(webdav-backend)
diff --git a/src/modules/nss-pkcs11/CMakeLists.txt b/src/modules/nss-pkcs11/CMakeLists.txt
new file mode 100644
index 000000000..2fcd05798
--- /dev/null
+++ b/src/modules/nss-pkcs11/CMakeLists.txt
@@ -0,0 +1,41 @@
+set(extra_deps
+	ebook
+	ebook-contacts
+)
+
+set(sources
+	object.c
+	object.h
+	pkcs11.c
+	pkcs11.h
+	pkcs11f.h
+	pkcs11t.h
+	session.c
+	session.h
+	util.c
+	util.h
+)
+
+set(extra_defines)
+
+set(extra_cflags
+	${CAMEL_CFLAGS}
+)
+
+set(extra_incdirs
+	${CAMEL_INCLUDE_DIRS}
+)
+
+set(extra_ldflags
+	${CAMEL_LDFLAGS}
+)
+
+add_simple_module(module-nss-pkcs11
+	sources
+	extra_deps
+	extra_defines
+	extra_cflags
+	extra_incdirs
+	extra_ldflags
+	${privlibdir}
+)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index bba04282a..9416adfaf 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -59,4 +59,5 @@ add_subdirectory(libecal)
 add_subdirectory(libedata-book)
 add_subdirectory(libedata-cal)
 add_subdirectory(libedataserver)
+add_subdirectory(nss-pkcs11)
 add_subdirectory(test-server-utils)
diff --git a/tests/nss-pkcs11/CMakeLists.txt b/tests/nss-pkcs11/CMakeLists.txt
new file mode 100644
index 000000000..542c15e6c
--- /dev/null
+++ b/tests/nss-pkcs11/CMakeLists.txt
@@ -0,0 +1,65 @@
+set(extra_deps
+	ebook
+	ebook-contacts
+)
+
+set(extra_defines
+	-DMODULEDIR=\"${privlibdir}\"
+)
+
+set(extra_cflags
+	${ADDRESSBOOK_CFLAGS}
+)
+
+set(extra_incdirs
+	${ADDRESSBOOK_INCLUDE_DIRS}
+)
+
+set(extra_ldflags
+	${ADDRESSBOOK_LDFLAGS}
+)
+
+set(SOURCES
+	test-app.c
+	test-session.c
+	test-search.c
+	test-attribute-value.c
+)
+
+build_only_installable_test(
+	test-app
+	SOURCES
+	extra_deps
+	extra_defines
+	extra_cflags
+	extra_incdirs
+	extra_ldflags
+)
+
+set(SOURCES
+	addressbook-access-test.c
+)
+
+build_only_installable_test(
+	addressbook-access-test
+	SOURCES
+	extra_deps
+	extra_defines
+	extra_cflags
+	extra_incdirs
+	extra_ldflags
+)
+
+set(SOURCES
+	test.c
+)
+
+build_only_installable_test(
+	load-test
+	SOURCES
+	extra_deps
+	extra_defines
+	extra_cflags
+	extra_incdirs
+	extra_ldflags
+)
