From 8fef5344bb6445d15fe3400c41d3070a1dc43e01 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Mon, 4 Feb 2013 05:55:54 -0800 Subject: [PATCH] LayerManagerBase: fixed unit test build to use unit test configuration Signed-off-by: Timo Lotterbach --- LayerManagerBase/CMakeLists.txt | 37 ++------------------ LayerManagerBase/tests/CMakeLists.txt | 64 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 35 deletions(-) create mode 100644 LayerManagerBase/tests/CMakeLists.txt diff --git a/LayerManagerBase/CMakeLists.txt b/LayerManagerBase/CMakeLists.txt index a388440..3d6c522 100644 --- a/LayerManagerBase/CMakeLists.txt +++ b/LayerManagerBase/CMakeLists.txt @@ -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 index 0000000..5e426ef --- /dev/null +++ b/LayerManagerBase/tests/CMakeLists.txt @@ -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) + -- 2.7.4