Commit 863eba92 authored by Rolf Pfeffertal's avatar Rolf Pfeffertal

add cmake options for building tests and examples, disabled by default

parent b66415aa
...@@ -2,6 +2,9 @@ cmake_minimum_required (VERSION 3.0.2) ...@@ -2,6 +2,9 @@ cmake_minimum_required (VERSION 3.0.2)
project (pistache) project (pistache)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
option(PISTACHE_BUILD_EXAMPLES "build examples alongside the project" OFF)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11) if(COMPILER_SUPPORTS_CXX11)
...@@ -17,15 +20,19 @@ add_subdirectory (src) ...@@ -17,15 +20,19 @@ add_subdirectory (src)
include_directories (src) include_directories (src)
add_subdirectory (examples) if (PISTACHE_BUILD_EXAMPLES)
add_subdirectory (examples)
endif()
find_package(GTest) if (PISTACHE_BUILD_TESTS)
if (GTEST_FOUND) find_package(GTest)
if (GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS}) include_directories(${GTEST_INCLUDE_DIRS})
else() else()
ADD_SUBDIRECTORY (googletest-release-1.7.0) ADD_SUBDIRECTORY (googletest-release-1.7.0)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
endif() endif()
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment