LayerManagerBase: fixed unit test build to use unit test configuration
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Mon, 4 Feb 2013 13:55:54 +0000 (05:55 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Tue, 5 Feb 2013 13:59:32 +0000 (05:59 -0800)
Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerBase/CMakeLists.txt
LayerManagerBase/tests/CMakeLists.txt [new file with mode: 0644]

index a388440..3d6c522 100644 (file)
@@ -74,41 +74,6 @@ file(GLOB LM_INCLUDES include/*.h)
 install (FILES ${LM_INCLUDES} DESTINATION include/layermanager)
 
 
-if (WITH_TESTS)
-
-    find_package (Threads)
-
-    enable_testing()
-
-    add_executable(${PROJECT_NAME}_Test
-        tests/SceneTest.cpp
-        tests/ScreenTest.cpp
-        tests/LayermanagerTest.cpp
-        tests/InputManagerTest.cpp
-        tests/GraphicalObjectTest.cpp
-        tests/GraphicalSurfaceTest.cpp
-        tests/SurfaceTest.cpp
-        tests/LayerTest.cpp
-        tests/ShaderTest.cpp
-        tests/ShaderUniformTest.cpp
-        tests/ShaderProgramTest.cpp
-        tests/ShaderProgramFactoryTest.cpp
-        tests/RectangleTest.cpp
-    )
-
-    target_link_libraries(${PROJECT_NAME}_Test
-        ${LIBS}
-        LayerManagerBase
-        gtest
-        gmock
-        ${CMAKE_THREAD_LIBS_INIT}
-    )
-
-    add_test(${PROJECT_NAME} ${PROJECT_NAME}_Test)
-
-endif(WITH_TESTS) 
-
-
 #=============================================================
 # configuration depending on system
 #=============================================================
@@ -120,3 +85,5 @@ include(CheckIncludeFiles)
 check_include_files(execinfo.h HAVE_EXECINFO_H)
 export_build_flag(HAVE_EXECINFO_H "platform has execinfo.h header file")
 
+
+add_subdirectory(tests)
diff --git a/LayerManagerBase/tests/CMakeLists.txt b/LayerManagerBase/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5e426ef
--- /dev/null
@@ -0,0 +1,64 @@
+############################################################################
+# 
+# Copyright 2010-2012 BMW Car IT GmbH
+# 
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); 
+# you may not use this file except in compliance with the License. 
+# You may obtain a copy of the License at 
+#
+#       http://www.apache.org/licenses/LICENSE-2.0 
+#
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+if (WITH_TESTS)
+
+    enable_testing()
+
+    project(LayerManagerBase_Test)
+    project_type(TEST)
+
+    set(LIBS ${LIBS}
+        LayerManagerBase
+        gtest
+        gmock
+    )
+
+    add_executable(${PROJECT_NAME}
+        SceneTest.cpp
+        ScreenTest.cpp
+        LayermanagerTest.cpp
+        InputManagerTest.cpp
+        GraphicalObjectTest.cpp
+        GraphicalSurfaceTest.cpp
+        SurfaceTest.cpp
+        LayerTest.cpp
+        ShaderTest.cpp
+        ShaderUniformTest.cpp
+        ShaderProgramTest.cpp
+        ShaderProgramFactoryTest.cpp
+        RectangleTest.cpp
+    )
+
+    target_link_libraries(${PROJECT_NAME}
+        ${LIBS}
+        ${CMAKE_THREAD_LIBS_INIT}
+    )
+
+    add_dependencies(${PROJECT_NAME} ${LIBS})
+
+    install(FILES       ${PROJECT_NAME}
+            DESTINATION bin)
+
+    add_test(LayerManagerBase ${PROJECT_NAME})
+
+endif(WITH_TESTS) 
+