Skip to content

Commit

Permalink
Add testing framework
Browse files Browse the repository at this point in the history
  • Loading branch information
szechyjs committed Dec 17, 2013
1 parent cbe1923 commit 138838c
Show file tree
Hide file tree
Showing 67 changed files with 49,822 additions and 6 deletions.
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
project(mbe)
cmake_minimum_required(VERSION 2.6)

FILE(GLOB SRCS *.c)

include_directories("${PROJECT_SOURCE_DIR}")

ADD_LIBRARY(mbe-static STATIC ${SRCS})
ADD_LIBRARY(mbe-shared SHARED ${SRCS})
TARGET_LINK_LIBRARIES(mbe-static m)
TARGET_LINK_LIBRARIES(mbe-shared m)

install(TARGETS mbe-static mbe-shared DESTINATION lib)
install (FILES "${PROJECT_SOURCE_DIR}/mbelib.h" DESTINATION include)

set_target_properties(mbe-static mbe-shared PROPERTIES OUTPUT_NAME mbe
VERSION 1.0 SOVERSION 1 INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib )

Expand All @@ -23,4 +23,10 @@ configure_file(
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

option(DISABLE_TEST "Disable building of test framework." OFF)

if (NOT DISABLE_TEST)
add_subdirectory(test)
endif()
20 changes: 20 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
project(mbetest)

add_subdirectory(gtest)
add_subdirectory(gmock)

FILE(GLOB SRCS *.cpp)

include_directories(
${PROJECT_SOURCE_DIR}/gtest/include
${PROJECT_SOURCE_DIR}/gmock/include
${mbe_SOURCE_DIR}
)

add_custom_target(test
DEPENDS mbetest
COMMAND mbetest
)

ADD_EXECUTABLE(mbetest ${SRCS})
TARGET_LINK_LIBRARIES(mbetest mbe gmock gtest)
45 changes: 45 additions & 0 deletions test/gmock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
########################################################################
# CMake build script for Google Mock.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.

# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)

########################################################################
#
# Project-wide settings

# Name of the project.
#
# CMake files in this project can refer to the root source directory
# as ${gmock_SOURCE_DIR} and to the root binary directory as
# ${gmock_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
project(gmock CXX C)
cmake_minimum_required(VERSION 2.6.2)

# Adds Google Mock's and Google Test's header directories to the search path.
include_directories("${gmock_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}"
"${gtest_SOURCE_DIR}/include")

########################################################################
#
# Defines the gmock & gmock_main libraries. User tests should link
# with one of them.

# Google Mock libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that Google Mock can be compiled by
# a user aggressive about warnings.
cxx_library(gmock
"${cxx_strict}"
src/gmock-all.cc)

cxx_library(gmock_main
"${cxx_strict}"
src/gmock-all.cc
src/gmock_main.cc)
Loading

0 comments on commit 138838c

Please sign in to comment.