Skip to content

Instantly share code, notes, and snippets.

@fpersson
Created September 10, 2011 06:06
Show Gist options
  • Save fpersson/1207996 to your computer and use it in GitHub Desktop.
Save fpersson/1207996 to your computer and use it in GitHub Desktop.
a minimal working sample of cmake for gtest
# Breif - A minimal working CMakeLists.txt for goggle unittesting
# Author - Fredrik Persson - [email protected]
# Licens - BSD
cmake_minimum_required (VERSION 2.6)
project(demo)
find_package (GTest REQUIRED)
include_directories(${GTest_INCLUDE_DIRS})
set(CORELIBS ${GTEST_BOTH_LIBRARIES} )
set(CMAKE_CXX_FLAGS "-pthread")
add_executable(demo_unittest ${CORELIBS} test.cpp )
target_link_libraries(demo_unittest ${CORELIBS})
#include <gtest/gtest.h>
TEST(footest, inittest){
}
int main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
RUN_ALL_TESTS();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment