forked from fmtlib/fmt
Update CMake config
to version https://github.com/cppformat/cppformat/commit/7ee287d3d9e340737f3ad66292e7bc60a53b3053
This commit is contained in:
+12
-3
@@ -2,6 +2,14 @@ set(FMT_GMOCK_DIR ../gmock)
|
||||
|
||||
include_directories(.. ${FMT_GMOCK_DIR})
|
||||
|
||||
# Links target with cppformat and any libraries passed as extra arguments.
|
||||
function (target_link_cppformat target)
|
||||
target_link_libraries(${target} cppformat ${ARGN})
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -DFMT_SHARED)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
# We compile Google Test ourselves instead of using pre-compiled libraries.
|
||||
# See the Google Test FAQ "Why is it not recommended to install a
|
||||
# pre-compiled copy of Google Test (for example, into /usr/local)?"
|
||||
@@ -10,6 +18,7 @@ include_directories(.. ${FMT_GMOCK_DIR})
|
||||
add_library(gmock STATIC
|
||||
${FMT_GMOCK_DIR}/gmock-gtest-all.cc ${FMT_GMOCK_DIR}/gmock/gmock.h
|
||||
${FMT_GMOCK_DIR}/gtest/gtest.h ${FMT_GMOCK_DIR}/gtest/gtest-spi.h)
|
||||
target_include_directories(gmock INTERFACE ${FMT_GMOCK_DIR})
|
||||
find_package(Threads)
|
||||
if (Threads_FOUND)
|
||||
target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT})
|
||||
@@ -28,7 +37,7 @@ check_cxx_source_compiles("
|
||||
check_cxx_source_compiles("
|
||||
#include <initializer_list>
|
||||
int main() {}" FMT_INITIALIZER_LIST)
|
||||
|
||||
|
||||
if (NOT FMT_VARIADIC_TEMPLATES OR NOT FMT_INITIALIZER_LIST)
|
||||
add_definitions(-DGTEST_LANG_CXX11=0)
|
||||
endif ()
|
||||
@@ -45,7 +54,7 @@ endif ()
|
||||
|
||||
set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
|
||||
add_library(test-main STATIC ${TEST_MAIN_SRC})
|
||||
target_link_libraries(test-main cppformat gmock)
|
||||
target_link_cppformat(test-main gmock)
|
||||
|
||||
# Adds a test.
|
||||
# Usage: add_fmt_test(name [CUSTOM_LINK] srcs...)
|
||||
@@ -54,7 +63,7 @@ function(add_fmt_test name)
|
||||
add_executable(${name} ${name}.cc ${add_fmt_test_UNPARSED_ARGUMENTS})
|
||||
target_link_libraries(${name} test-main)
|
||||
if (NOT add_fmt_test_CUSTOM_LINK)
|
||||
target_link_libraries(${name} cppformat)
|
||||
target_link_cppformat(${name})
|
||||
endif ()
|
||||
add_test(NAME ${name} COMMAND ${name})
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user