Merge pull request #198 from maddinat0r/master

add CMake option to toggle tests (on by default)
This commit is contained in:
Victor Zverovich 2015-08-19 06:49:53 -07:00
commit 0d99eb5d6b

View File

@ -12,6 +12,7 @@ endif ()
option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
option(FMT_INSTALL "Generate install target." ON)
option(FMT_TESTS "Generate tests." ON)
project(FORMAT)
@ -108,15 +109,18 @@ endif ()
if (CPP11_FLAG AND FMT_PEDANTIC)
set(FMT_EXTRA_COMPILE_FLAGS "${FMT_EXTRA_COMPILE_FLAGS} ${CPP11_FLAG}")
# Test compilation with default flags.
if (FMT_TESTS)
file(GLOB src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*.cc test/*.h)
add_library(testformat STATIC ${FMT_SOURCE_FILES} ${src})
endif ()
endif ()
set_target_properties(cppformat
PROPERTIES COMPILE_FLAGS "${FMT_EXTRA_COMPILE_FLAGS}")
add_subdirectory(doc)
if (FMT_TESTS)
include_directories(. gmock)
# We compile Google Test ourselves instead of using pre-compiled libraries.
@ -189,6 +193,7 @@ endif ()
enable_testing()
add_subdirectory(test)
endif ()
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 2)