## CMake build script.

cmake_minimum_required (VERSION 2.8.8)

if (POLICY CMP0046)
    cmake_policy (SET CMP0042 NEW)
endif ()
if (POLICY CMP0054)
    cmake_policy (SET CMP0054 NEW)
endif ()

function (prepend __result __prefix)
    set (${__result})
    foreach (__cursor ${ARGN})
        list (APPEND ${__result} "${__prefix}/${__cursor}")
    endforeach ()
    set (${__result} "${${__result}}" PARENT_SCOPE)
endfunction ()

enable_language (C)
enable_language (CXX)


include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}")
link_directories (${CMAKE_CURRENT_SOURCE_DIR})

prepend (LIB_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src"
        gtest.cc
        gtest-death-test.cc
        gtest-filepath.cc
        gtest-port.cc
        gtest-printers.cc
        gtest-test-part.cc
        gtest-test-part.cc)
set (MAIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/gtest_main.cc")

#add_library (gtest      STATIC ${LIB_SRCS})
add_library  (gtest_main STATIC ${LIB_SRCS} ${MAIN_SRCS})


## CMake build script.

cmake_minimum_required (VERSION 2.8.8)

if (POLICY CMP0046)
    cmake_policy (SET CMP0042 NEW)
endif ()
if (POLICY CMP0054)
    cmake_policy (SET CMP0054 NEW)
endif ()

function (prepend __result __prefix)
    set (${__result})
    foreach (__cursor ${ARGN})
        list (APPEND ${__result} "${__prefix}/${__cursor}")
    endforeach ()
    set (${__result} "${${__result}}" PARENT_SCOPE)
endfunction ()

enable_language (C)
enable_language (CXX)


include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}")
link_directories (${CMAKE_CURRENT_SOURCE_DIR})

prepend (LIB_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src"
        gtest.cc
        gtest-death-test.cc
        gtest-filepath.cc
        gtest-port.cc
        gtest-printers.cc
        gtest-test-part.cc
        gtest-test-part.cc)
set (MAIN_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/gtest_main.cc")

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    add_compile_options (-Wno-unused-const-variable)
endif ()

#add_library (gtest      STATIC ${LIB_SRCS})
add_library  (gtest_main STATIC ${LIB_SRCS} ${MAIN_SRCS})


Disable unused-const-variable warning in gtest_main target.
Disable unused-const-variable warning in gtest_main target.
