blob: 0a17358f419b855e5323ae0b50b2d32e1b589fef [file] [log] [blame]
Victor Zverovichae4a3942018-07-14 06:34:20 -07001cmake_minimum_required(VERSION 3.1.0)
Victor Zverovichcb999192012-12-07 09:02:15 -08002
Victor Zverovicha9e26152018-07-17 08:54:22 -07003# Use newer policies if available, up to most recent tested version of CMake.
Henry Fredrick Schreinerefd8ee82018-07-16 12:37:54 +02004if(${CMAKE_VERSION} VERSION_LESS 3.11)
Victor Zverovicha9e26152018-07-17 08:54:22 -07005 cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
Henry Fredrick Schreinerefd8ee82018-07-16 12:37:54 +02006else()
Victor Zverovicha9e26152018-07-17 08:54:22 -07007 cmake_policy(VERSION 3.11)
Henry Fredrick Schreinerefd8ee82018-07-16 12:37:54 +02008endif()
9
Victor Zverovich5e1576f2016-04-24 07:45:13 -070010# Determine if fmt is built as a subproject (using add_subdirectory)
vitaute49a4e02016-04-12 07:42:47 -040011# or if it is the master project.
Mario Wernerc1a4cd02016-02-03 11:20:19 +010012set(MASTER_PROJECT OFF)
13if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
14 set(MASTER_PROJECT ON)
Henry Fredrick Schreinerefd8ee82018-07-16 12:37:54 +020015 message(STATUS "CMake version: ${CMAKE_VERSION}")
Mario Wernerc1a4cd02016-02-03 11:20:19 +010016endif ()
17
Victor Zverovich5e4c34b2018-01-21 16:36:22 -080018# Joins arguments and places the results in ${result_var}.
19function(join result_var)
20 set(result )
21 foreach (arg ${ARGN})
22 set(result "${result}${arg}")
23 endforeach ()
24 set(${result_var} "${result}" PARENT_SCOPE)
25endfunction()
26
Victor Zverovich67679652012-12-07 09:41:02 -080027# Set the default CMAKE_BUILD_TYPE to Release.
28# This should be done before the project command since the latter can set
29# CMAKE_BUILD_TYPE itself (it does so for nmake).
Victor Zverovich53379df2019-03-17 10:50:19 -070030if (MASTER_PROJECT AND NOT CMAKE_BUILD_TYPE)
Victor Zverovich5e4c34b2018-01-21 16:36:22 -080031 join(doc "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or "
32 "CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
33 set(CMAKE_BUILD_TYPE Release CACHE STRING ${doc})
Victor Zverovich67679652012-12-07 09:41:02 -080034endif ()
35
vitauta5757c82015-05-12 07:35:29 -070036option(FMT_PEDANTIC "Enable extra warnings and expensive tests." OFF)
Victor Zverovich8bc0adb2019-04-13 06:56:34 -070037option(FMT_WERROR "Halt the compilation with an error on compiler warnings."
38 OFF)
vitaut75fdfe32015-08-31 06:49:06 -070039
40# Options that control generation of various targets.
Mario Wernerc1a4cd02016-02-03 11:20:19 +010041option(FMT_DOC "Generate the doc target." ${MASTER_PROJECT})
42option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT})
43option(FMT_TEST "Generate the test target." ${MASTER_PROJECT})
Paul Dreik9d972012019-06-30 09:11:13 +020044option(FMT_FUZZ "Generate the fuzz target." OFF)
Victor Zverovich7042d142014-06-06 06:35:28 -070045
Victor Zverovich544b9272019-04-17 06:18:53 -070046project(FMT CXX)
Victor Zverovicha23a8d12012-12-07 10:04:01 -080047
Victor Zverovich5e4c34b2018-01-21 16:36:22 -080048# Get version from core.h
49file(READ include/fmt/core.h core_h)
50if (NOT core_h MATCHES "FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])")
51 message(FATAL_ERROR "Cannot get FMT_VERSION from core.h.")
Mario Wernerb52d0bd2016-01-29 13:18:02 +010052endif ()
Victor Zverovich5e4c34b2018-01-21 16:36:22 -080053# Use math to skip leading zeros if any.
54math(EXPR CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
55math(EXPR CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
56math(EXPR CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
57join(FMT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.
58 ${CPACK_PACKAGE_VERSION_PATCH})
59message(STATUS "Version: ${FMT_VERSION}")
Mario Wernerb52d0bd2016-01-29 13:18:02 +010060
Victor Zverovicheb04e9a2014-07-10 09:14:24 -070061message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
62
Victor Zverovich07754c02015-03-01 16:07:18 -080063set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
64
Victor Zverovich269c3ba2014-04-23 17:21:18 -070065set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
Victor Zverovich2b35c9e2015-02-21 16:02:44 -080066 "${CMAKE_CURRENT_SOURCE_DIR}/support/cmake")
Victor Zverovich269c3ba2014-04-23 17:21:18 -070067
Victor Zverovichd5e918b2017-09-28 08:46:47 -070068include(cxx14)
Elias Kosunen691a7a92018-06-06 16:57:59 +030069include(CheckCXXCompilerFlag)
Mario Werner0fb474b2016-01-29 13:03:47 +010070
Lectem6e37c202019-04-07 12:15:24 +020071set(FMT_REQUIRED_FEATURES cxx_auto_type cxx_variadic_templates)
72
Elias Kosunen691a7a92018-06-06 16:57:59 +030073if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
74 set(PEDANTIC_COMPILE_FLAGS -pedantic-errors -Wall -Wextra -pedantic
Victor Zverovich2d2326a2018-10-22 21:05:59 -070075 -Wold-style-cast -Wundef
Victor Zverovich34030de2018-11-06 17:04:33 -080076 -Wredundant-decls -Wwrite-strings -Wpointer-arith
Elias Kosunen691a7a92018-06-06 16:57:59 +030077 -Wcast-qual -Wformat=2 -Wmissing-include-dirs
78 -Wcast-align -Wnon-virtual-dtor
79 -Wctor-dtor-privacy -Wdisabled-optimization
Victor Zverovichf0d0a1e2018-08-25 16:08:32 -070080 -Winvalid-pch -Woverloaded-virtual
Victor Zverovich3de36e92019-11-26 09:10:24 -080081 -Wconversion -Wswitch-enum
Sign Bit0bbdca52018-12-20 09:24:19 -050082 -Wno-ctor-dtor-privacy -Wno-format-nonliteral -Wno-shadow)
Elias Kosunen691a7a92018-06-06 16:57:59 +030083 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
Sign Bit0bbdca52018-12-20 09:24:19 -050084 set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnoexcept
85 -Wno-dangling-else -Wno-unused-local-typedefs)
Elias Kosunen691a7a92018-06-06 16:57:59 +030086 endif ()
87 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
88 set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wdouble-promotion
89 -Wtrampolines -Wzero-as-null-pointer-constant -Wuseless-cast
90 -Wvector-operation-performance -Wsized-deallocation)
91 endif ()
92 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
93 set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2
94 -Wnull-dereference -Wduplicated-cond)
95 endif ()
Elias Kosunen691a7a92018-06-06 16:57:59 +030096 set(WERROR_FLAG -Werror)
97endif ()
98
Victor Zverovicha11eb3a2018-08-22 09:07:17 -070099if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Victor Zverovich8bc0adb2019-04-13 06:56:34 -0700100 set(PEDANTIC_COMPILE_FLAGS -Wall -Wextra -pedantic -Wconversion
Deniz Evrenci96f91422019-10-12 02:44:20 +0900101 -Wno-sign-conversion -Wdeprecated -Wweak-vtables)
Victor Zverovich34030de2018-11-06 17:04:33 -0800102 check_cxx_compiler_flag(-Wzero-as-null-pointer-constant HAS_NULLPTR_WARNING)
Elias Kosunen691a7a92018-06-06 16:57:59 +0300103 if (HAS_NULLPTR_WARNING)
Victor Zverovich98751472018-08-22 07:40:06 -0700104 set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS}
Victor Zverovich34030de2018-11-06 17:04:33 -0800105 -Wzero-as-null-pointer-constant)
Elias Kosunen691a7a92018-06-06 16:57:59 +0300106 endif ()
Victor Zverovich34030de2018-11-06 17:04:33 -0800107 set(WERROR_FLAG -Werror)
Elias Kosunen691a7a92018-06-06 16:57:59 +0300108endif ()
109
110if (MSVC)
Victor Zverovich6322b472018-06-06 16:51:35 +0200111 set(PEDANTIC_COMPILE_FLAGS /W3)
Elias Kosunen691a7a92018-06-06 16:57:59 +0300112 set(WERROR_FLAG /WX)
Mario Wernerb52d0bd2016-01-29 13:18:02 +0100113endif ()
114
Mario Wernerc1a4cd02016-02-03 11:20:19 +0100115if (MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
Victor Zverovich269c3ba2014-04-23 17:21:18 -0700116 # If Microsoft SDK is installed create script run-msbuild.bat that
Jakub Wilke0ac51c2016-05-01 12:29:21 +0200117 # calls SetEnv.cmd to set up build environment and runs msbuild.
Victor Zverovich269c3ba2014-04-23 17:21:18 -0700118 # It is useful when building Visual Studio projects with the SDK
119 # toolchain rather than Visual Studio.
120 include(FindSetEnv)
121 if (WINSDK_SETENV)
122 set(MSBUILD_SETUP "call \"${WINSDK_SETENV}\"")
123 endif ()
Victor Zverovich60c92a72014-04-29 05:56:47 -0700124 # Set FrameworkPathOverride to get rid of MSB3644 warnings.
Victor Zverovichb6afd932014-10-06 08:20:52 -0700125 set(netfxpath "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0")
Victor Zverovich269c3ba2014-04-23 17:21:18 -0700126 file(WRITE run-msbuild.bat "
127 ${MSBUILD_SETUP}
Victor Zverovichb6afd932014-10-06 08:20:52 -0700128 ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
Victor Zverovich269c3ba2014-04-23 17:21:18 -0700129endif ()
130
Victor Zverovichd5d58652019-06-23 17:10:57 -0700131set(strtod_l_headers stdlib.h)
132if (APPLE)
133 set(strtod_l_headers ${strtod_l_headers} xlocale.h)
134endif ()
135
Victor Zverovicheaa89e22014-06-09 09:07:27 -0700136include(CheckSymbolExists)
137if (WIN32)
Victor Zverovichd5d58652019-06-23 17:10:57 -0700138 check_symbol_exists(_strtod_l "${strtod_l_headers}" HAVE_STRTOD_L)
Victor Zverovicheaa89e22014-06-09 09:07:27 -0700139else ()
Victor Zverovichd5d58652019-06-23 17:10:57 -0700140 check_symbol_exists(strtod_l "${strtod_l_headers}" HAVE_STRTOD_L)
Victor Zverovicheaa89e22014-06-09 09:07:27 -0700141endif ()
Victor Zveroviche1c046c2014-09-29 09:27:32 -0700142
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800143function(add_headers VAR)
144 set(headers ${${VAR}})
145 foreach (header ${ARGN})
146 set(headers ${headers} include/fmt/${header})
147 endforeach()
148 set(${VAR} ${headers} PARENT_SCOPE)
149endfunction()
150
151# Define the fmt library, its includes and the needed defines.
Victor Zverovich9393fe22019-07-25 19:01:21 +0300152add_headers(FMT_HEADERS chrono.h color.h compile.h core.h format.h format-inl.h
Victor Zverovich092d2dc2019-11-20 07:51:14 -0800153 locale.h ostream.h posix.h printf.h ranges.h)
Victor Zverovichdcde0892019-11-15 05:41:14 -0800154set(FMT_SOURCES src/format.cc src/posix.cc)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800155
Victor Zverovich25b72fc2019-05-15 08:43:54 -0700156add_library(fmt ${FMT_SOURCES} ${FMT_HEADERS} README.rst ChangeLog.rst)
Victor Zveroviche02aacc2018-03-13 13:03:18 -0400157add_library(fmt::fmt ALIAS fmt)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800158
Victor Zverovichd5d58652019-06-23 17:10:57 -0700159if (HAVE_STRTOD_L)
160 target_compile_definitions(fmt PUBLIC FMT_LOCALE)
161endif ()
162
Elias Kosunen691a7a92018-06-06 16:57:59 +0300163if (FMT_WERROR)
164 target_compile_options(fmt PRIVATE ${WERROR_FLAG})
165endif ()
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800166if (FMT_PEDANTIC)
167 target_compile_options(fmt PRIVATE ${PEDANTIC_COMPILE_FLAGS})
168endif ()
169
Lectem6e37c202019-04-07 12:15:24 +0200170target_compile_features(fmt INTERFACE ${FMT_REQUIRED_FEATURES})
Lectem3de3d762019-04-02 00:04:03 +0200171
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800172target_include_directories(fmt PUBLIC
173 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
174 $<INSTALL_INTERFACE:include>)
175
176set_target_properties(fmt PROPERTIES
Victor Zverovich403ae0a2018-02-10 07:17:40 -0800177 VERSION ${FMT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}
178 DEBUG_POSTFIX d)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800179
180if (BUILD_SHARED_LIBS)
Vedran Miletićf7aedc52019-09-19 21:25:43 +0200181 if (UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800182 # Fix rpmlint warning:
183 # unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
184 target_link_libraries(fmt -Wl,--as-needed)
185 endif ()
186 target_compile_definitions(fmt PRIVATE FMT_EXPORT INTERFACE FMT_SHARED)
187endif ()
Paul Dreik9d972012019-06-30 09:11:13 +0200188if (FMT_SAFE_DURATION_CAST)
Victor Zverovich2711cb12019-06-30 08:52:15 -0700189 target_compile_definitions(fmt PUBLIC FMT_SAFE_DURATION_CAST)
Paul Dreik9d972012019-06-30 09:11:13 +0200190endif()
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800191
Elias Kosunen691a7a92018-06-06 16:57:59 +0300192add_library(fmt-header-only INTERFACE)
193add_library(fmt::fmt-header-only ALIAS fmt-header-only)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800194
Elias Kosunen691a7a92018-06-06 16:57:59 +0300195target_compile_definitions(fmt-header-only INTERFACE FMT_HEADER_ONLY=1)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800196
Lectem6e37c202019-04-07 12:15:24 +0200197target_compile_features(fmt-header-only INTERFACE ${FMT_REQUIRED_FEATURES})
Lectem3de3d762019-04-02 00:04:03 +0200198
Elias Kosunen691a7a92018-06-06 16:57:59 +0300199target_include_directories(fmt-header-only INTERFACE
200 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
201 $<INSTALL_INTERFACE:include>)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800202
203# Install targets.
204if (FMT_INSTALL)
Victor Zverovichc96d6462018-02-10 07:00:14 -0800205 include(GNUInstallDirs)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800206 include(CMakePackageConfigHelpers)
Victor Zverovichc96d6462018-02-10 07:00:14 -0800207 set(FMT_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/fmt CACHE STRING
Victor Zverovich8bc0adb2019-04-13 06:56:34 -0700208 "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800209 set(version_config ${PROJECT_BINARY_DIR}/fmt-config-version.cmake)
210 set(project_config ${PROJECT_BINARY_DIR}/fmt-config.cmake)
Cole Mickens9d0c9c42018-10-24 01:33:22 -0700211 set(pkgconfig ${PROJECT_BINARY_DIR}/fmt.pc)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800212 set(targets_export_name fmt-targets)
213
214 set (INSTALL_TARGETS fmt)
215 if (TARGET fmt-header-only)
216 set(INSTALL_TARGETS ${INSTALL_TARGETS} fmt-header-only)
217 endif ()
218
Victor Zverovichc96d6462018-02-10 07:00:14 -0800219 set(FMT_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
220 "Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.")
221
222 set(FMT_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR}/fmt CACHE STRING
223 "Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.")
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800224
Olaf Hering9e1531c2019-03-25 17:16:18 +0100225 set(FMT_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH
Victor Zverovich8bc0adb2019-04-13 06:56:34 -0700226 "Installation directory for pkgconfig (.pc) files, relative to ${CMAKE_INSTALL_PREFIX}.")
Cole Mickens9d0c9c42018-10-24 01:33:22 -0700227
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800228 # Generate the version, config and target files into the build directory.
229 write_basic_package_version_file(
230 ${version_config}
231 VERSION ${FMT_VERSION}
232 COMPATIBILITY AnyNewerVersion)
Cole Mickens9d0c9c42018-10-24 01:33:22 -0700233 configure_file(
234 "${PROJECT_SOURCE_DIR}/support/cmake/fmt.pc.in"
235 "${pkgconfig}"
236 @ONLY)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800237 configure_package_config_file(
238 ${PROJECT_SOURCE_DIR}/support/cmake/fmt-config.cmake.in
239 ${project_config}
240 INSTALL_DESTINATION ${FMT_CMAKE_DIR})
Victor Zveroviche02aacc2018-03-13 13:03:18 -0400241 # Use a namespace because CMake provides better diagnostics for namespaced
242 # imported targets.
243 export(TARGETS ${INSTALL_TARGETS} NAMESPACE fmt::
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800244 FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
245
246 # Install version, config and target files.
247 install(
248 FILES ${project_config} ${version_config}
249 DESTINATION ${FMT_CMAKE_DIR})
Victor Zverovich7bab90e2018-03-13 22:45:14 -0400250 install(EXPORT ${targets_export_name} DESTINATION ${FMT_CMAKE_DIR}
Victor Zveroviche02aacc2018-03-13 13:03:18 -0400251 NAMESPACE fmt::)
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800252
253 # Install the library and headers.
254 install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
Robert Franke159f89e2019-11-29 17:01:32 +0100255 LIBRARY DESTINATION ${FMT_LIB_DIR}
256 ARCHIVE DESTINATION ${FMT_LIB_DIR}
257 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Andreas Schönle9d4ef942018-11-19 14:58:17 +0100258
Victor Zverovich8bc0adb2019-04-13 06:56:34 -0700259 install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}>
260 DESTINATION ${FMT_LIB_DIR} OPTIONAL)
Victor Zverovichc96d6462018-02-10 07:00:14 -0800261 install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR})
Cole Mickens9d0c9c42018-10-24 01:33:22 -0700262 install(FILES "${pkgconfig}" DESTINATION "${FMT_PKGCONFIG_DIR}")
Victor Zverovich84bd2f12017-12-03 09:59:55 -0800263endif ()
vitautb83fd002015-11-23 08:10:02 -0800264
vitaut75fdfe32015-08-31 06:49:06 -0700265if (FMT_DOC)
Alex Martin06c18592015-08-30 14:23:54 +0200266 add_subdirectory(doc)
267endif ()
Victor Zverovich382e25e2012-12-18 08:44:00 -0800268
vitaut75fdfe32015-08-31 06:49:06 -0700269if (FMT_TEST)
Alex Martin914b9782015-08-19 10:41:37 +0200270 enable_testing()
271 add_subdirectory(test)
Victor Zverovicha734f672014-09-18 09:18:18 -0700272endif ()
273
Victor Zverovich2711cb12019-06-30 08:52:15 -0700274# Control fuzzing independent of the unit tests.
Paul Dreik9d972012019-06-30 09:11:13 +0200275if (FMT_FUZZ)
276 add_subdirectory(test/fuzzing)
277endif ()
278
Mario Wernerb52d0bd2016-01-29 13:18:02 +0100279set(gitignore ${PROJECT_SOURCE_DIR}/.gitignore)
Mario Wernerc1a4cd02016-02-03 11:20:19 +0100280if (MASTER_PROJECT AND EXISTS ${gitignore})
Victor Zverovich10b2fe02014-04-14 12:54:03 -0700281 # Get the list of ignored files from .gitignore.
vitaut22f61142016-01-13 07:14:32 -0800282 file (STRINGS ${gitignore} lines)
Victor Zverovich10b2fe02014-04-14 12:54:03 -0700283 LIST(REMOVE_ITEM lines /doc/html)
284 foreach (line ${lines})
Victor Zverovichcb389f92014-05-13 09:28:53 -0700285 string(REPLACE "." "[.]" line "${line}")
Victor Zverovich10b2fe02014-04-14 12:54:03 -0700286 string(REPLACE "*" ".*" line "${line}")
287 set(ignored_files ${ignored_files} "${line}$" "${line}/")
288 endforeach ()
Victor Zverovichfb67a2f2016-05-08 07:28:34 -0700289 set(ignored_files ${ignored_files}
vitaut005379a2015-08-31 08:21:59 -0700290 /.git /breathe /format-benchmark sphinx/ .buildinfo .doctrees)
Victor Zverovich10b2fe02014-04-14 12:54:03 -0700291
292 set(CPACK_SOURCE_GENERATOR ZIP)
293 set(CPACK_SOURCE_IGNORE_FILES ${ignored_files})
Victor Zverovich848ab632016-04-24 07:16:33 -0700294 set(CPACK_SOURCE_PACKAGE_FILE_NAME fmt-${FMT_VERSION})
295 set(CPACK_PACKAGE_NAME fmt)
Mario Wernerb52d0bd2016-01-29 13:18:02 +0100296 set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.rst)
Victor Zverovich10b2fe02014-04-14 12:54:03 -0700297 include(CPack)
298endif ()