From 170f5c671f509d875dd84fd8ddf097989c43af60 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 21 Oct 2017 07:38:49 -0700 Subject: [PATCH] Move headers to include/fmt --- CMakeLists.txt | 2 +- {fmt => include/fmt}/CMakeLists.txt | 7 ++++--- {fmt => include/fmt}/format.cc | 0 {fmt => include/fmt}/format.h | 0 {fmt => include/fmt}/ostream.cc | 0 {fmt => include/fmt}/ostream.h | 0 {fmt => include/fmt}/posix.cc | 0 {fmt => include/fmt}/posix.h | 0 {fmt => include/fmt}/printf.cc | 0 {fmt => include/fmt}/printf.h | 0 {fmt => include/fmt}/string.h | 0 {fmt => include/fmt}/time.h | 0 {fmt => include/fmt}/write.h | 0 test/CMakeLists.txt | 18 +++++++++++------- 14 files changed, 16 insertions(+), 11 deletions(-) rename {fmt => include/fmt}/CMakeLists.txt (94%) rename {fmt => include/fmt}/format.cc (100%) rename {fmt => include/fmt}/format.h (100%) rename {fmt => include/fmt}/ostream.cc (100%) rename {fmt => include/fmt}/ostream.h (100%) rename {fmt => include/fmt}/posix.cc (100%) rename {fmt => include/fmt}/posix.h (100%) rename {fmt => include/fmt}/printf.cc (100%) rename {fmt => include/fmt}/printf.h (100%) rename {fmt => include/fmt}/string.h (100%) rename {fmt => include/fmt}/time.h (100%) rename {fmt => include/fmt}/write.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47319e1d..58050201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ else () check_symbol_exists(open fcntl.h HAVE_OPEN) endif () -add_subdirectory(fmt) +add_subdirectory(include/fmt) if (FMT_DOC) add_subdirectory(doc) diff --git a/fmt/CMakeLists.txt b/include/fmt/CMakeLists.txt similarity index 94% rename from fmt/CMakeLists.txt rename to include/fmt/CMakeLists.txt index ac3ad4ea..ccde97ed 100644 --- a/fmt/CMakeLists.txt +++ b/include/fmt/CMakeLists.txt @@ -7,7 +7,8 @@ if (HAVE_OPEN) set(FMT_SOURCES ${FMT_SOURCES} posix.cc) endif () -add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} ../README.rst ../ChangeLog.rst) +add_library(fmt + ${FMT_SOURCES} ${FMT_HEADERS} ../../README.rst ../../ChangeLog.rst) option(FMT_CPPFORMAT "Build cppformat library for backward compatibility." OFF) if (FMT_CPPFORMAT) @@ -22,7 +23,7 @@ if (FMT_PEDANTIC) endif () target_include_directories(fmt PUBLIC - $ + $ $) set_target_properties(fmt PROPERTIES @@ -45,7 +46,7 @@ if (CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0) target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1) target_include_directories(fmt-header-only INTERFACE - $ + $ $) endif () diff --git a/fmt/format.cc b/include/fmt/format.cc similarity index 100% rename from fmt/format.cc rename to include/fmt/format.cc diff --git a/fmt/format.h b/include/fmt/format.h similarity index 100% rename from fmt/format.h rename to include/fmt/format.h diff --git a/fmt/ostream.cc b/include/fmt/ostream.cc similarity index 100% rename from fmt/ostream.cc rename to include/fmt/ostream.cc diff --git a/fmt/ostream.h b/include/fmt/ostream.h similarity index 100% rename from fmt/ostream.h rename to include/fmt/ostream.h diff --git a/fmt/posix.cc b/include/fmt/posix.cc similarity index 100% rename from fmt/posix.cc rename to include/fmt/posix.cc diff --git a/fmt/posix.h b/include/fmt/posix.h similarity index 100% rename from fmt/posix.h rename to include/fmt/posix.h diff --git a/fmt/printf.cc b/include/fmt/printf.cc similarity index 100% rename from fmt/printf.cc rename to include/fmt/printf.cc diff --git a/fmt/printf.h b/include/fmt/printf.h similarity index 100% rename from fmt/printf.h rename to include/fmt/printf.h diff --git a/fmt/string.h b/include/fmt/string.h similarity index 100% rename from fmt/string.h rename to include/fmt/string.h diff --git a/fmt/time.h b/include/fmt/time.h similarity index 100% rename from fmt/time.h rename to include/fmt/time.h diff --git a/fmt/write.h b/include/fmt/write.h similarity index 100% rename from fmt/write.h rename to include/fmt/write.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b99925fa..ab6faae1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -98,8 +98,9 @@ endif () if (HAVE_OPEN) add_fmt_executable(posix-mock-test - posix-mock-test.cc ../fmt/format.cc ${TEST_MAIN_SRC}) - target_include_directories(posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}) + posix-mock-test.cc ../include/fmt/format.cc ${TEST_MAIN_SRC}) + target_include_directories( + posix-mock-test PRIVATE ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(posix-mock-test PRIVATE FMT_USE_FILE_DESCRIPTORS=1) target_link_libraries(posix-mock-test gmock) add_test(NAME posix-mock-test COMMAND posix-mock-test) @@ -112,25 +113,28 @@ target_link_libraries(header-only-test gmock) if (TARGET fmt-header-only) target_link_libraries(header-only-test fmt-header-only) else () - target_include_directories(header-only-test PRIVATE ${PROJECT_SOURCE_DIR}) + target_include_directories( + header-only-test PRIVATE ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(header-only-test PRIVATE FMT_HEADER_ONLY=1) endif () # Test that the library can be compiled with exceptions disabled. check_cxx_compiler_flag(-fno-exceptions HAVE_FNO_EXCEPTIONS_FLAG) if (HAVE_FNO_EXCEPTIONS_FLAG) - add_library(noexception-test ../fmt/format.cc) + add_library(noexception-test ../include/fmt/format.cc) target_compile_options(noexception-test PUBLIC ${CPP14_FLAG}) - target_include_directories(noexception-test PRIVATE ${PROJECT_SOURCE_DIR}) + target_include_directories( + noexception-test PRIVATE ${PROJECT_SOURCE_DIR}/include) target_compile_options(noexception-test PRIVATE -fno-exceptions) endif () if (FMT_PEDANTIC) # Test that the library compiles without windows.h. if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_library(no-windows-h-test ../fmt/format.cc) + add_library(no-windows-h-test ../include/fmt/format.cc) target_compile_options(no-windows-h-test PUBLIC ${CPP14_FLAG}) - target_include_directories(no-windows-h-test PRIVATE ${PROJECT_SOURCE_DIR}) + target_include_directories( + no-windows-h-test PRIVATE ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(no-windows-h-test PRIVATE FMT_USE_WINDOWS_H=0) endif ()