diff --git a/cmake/addLibrary.cmake b/cmake/addLibrary.cmake
new file mode 100644
index 000000000..5d9df168b
--- /dev/null
+++ b/cmake/addLibrary.cmake
@@ -0,0 +1,28 @@
+#
+# Copyright 2016 Rene Widera
+#
+# This file is part of cupla.
+#
+# cupla is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cupla is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with cupla.
+# If not, see .
+#
+
+macro(CUPLA_ADD_LIBRARY BinaryName)
+
+ alpaka_add_library(
+ ${BinaryName}
+ ${ARGN}
+ )
+ target_link_libraries(${BinaryName} PUBLIC cupla)
+endmacro()
diff --git a/cuplaConfig.cmake b/cuplaConfig.cmake
index 8d8fcd0b5..8e60ce250 100644
--- a/cuplaConfig.cmake
+++ b/cuplaConfig.cmake
@@ -80,6 +80,10 @@ get_filename_component(_cupla_ROOT_DIR "${_cupla_ROOT_DIR}" ABSOLUTE)
set(_cupla_ADD_EXECUTABLE_FILE "${_cupla_ROOT_DIR}/cmake/addExecutable.cmake")
include("${_cupla_ADD_EXECUTABLE_FILE}")
+# Add cupla_ADD_LIBRARY function.
+set(_cupla_ADD_LIBRARY_FILE "${_cupla_ROOT_DIR}/cmake/addLibrary.cmake")
+include("${_cupla_ADD_LIBRARY_FILE}")
+
################################################################################
# Set found to true initially and set it on false if a required dependency is missing.
################################################################################
diff --git a/test/separate_compilation/CMakeLists.txt b/test/separate_compilation/CMakeLists.txt
new file mode 100644
index 000000000..c05eb1d02
--- /dev/null
+++ b/test/separate_compilation/CMakeLists.txt
@@ -0,0 +1,28 @@
+################################################################################
+# Required CMake version.
+################################################################################
+
+cmake_minimum_required(VERSION 3.11.0)
+
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+################################################################################
+# Project.
+################################################################################
+
+project(separate_compilation)
+
+################################################################################
+# Find cupla
+################################################################################
+
+list(APPEND CMAKE_MODULE_PATH "${cupla_ROOT}")
+find_package("cupla" REQUIRED)
+
+
+################################################################################
+# Add library.
+################################################################################
+
+cupla_add_library(${PROJECT_NAME} STATIC "src/kernel.cpp")
+set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
diff --git a/test/separate_compilation/src/kernel.cpp b/test/separate_compilation/src/kernel.cpp
new file mode 100644
index 000000000..eee9a6f40
--- /dev/null
+++ b/test/separate_compilation/src/kernel.cpp
@@ -0,0 +1,6 @@
+#include "kernel.hpp"
+
+void TestClass::test()
+{
+ std::cout<<"separate compilation "<
+
+#include
+
+class TestClass
+{
+public:
+
+ void test();
+
+};