1
+ cmake_minimum_required (VERSION 3.9)
1
2
cmake_policy (SET CMP0048 NEW)
3
+
2
4
project (fast_double_parser LANGUAGES CXX VERSION 0.0.0.0)
3
- cmake_minimum_required (VERSION 3.9)
4
5
set (CMAKE_CXX_STANDARD 11)
5
6
set (CMAKE_CXX_STANDARD_REQUIRED ON )
6
7
if (NOT CMAKE_BUILD_TYPE )
@@ -18,31 +19,53 @@ set(rebogus_src tests/bogus.cpp)
18
19
set (benchmark_src benchmarks/benchmark.cpp)
19
20
20
21
21
- add_library (fast_double_parser INTERFACE )
22
- target_include_directories (fast_double_parser INTERFACE include /)
23
-
22
+ add_library (fast_double_parser INTERFACE ${headers} )
23
+ target_include_directories (fast_double_parser
24
+ INTERFACE
25
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /include >
26
+ $<INSTALL_INTERFACE:include >
27
+ )
28
+
29
+ include (GNUInstallDirs)
30
+ install (FILES ${headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR} " )
31
+ install (TARGETS fast_double_parser EXPORT fast_double_parser-targets)
32
+ install (
33
+ EXPORT fast_double_parser-targets
34
+ DESTINATION "share/fast_double_parser"
35
+ NAMESPACE fast_double_parser::
36
+ )
37
+
38
+ include (CMakePackageConfigHelpers)
39
+ configure_package_config_file(
40
+ "${CMAKE_CURRENT_SOURCE_DIR} /fast_double_parser-config.cmake.in"
41
+ "${CMAKE_CURRENT_BINARY_DIR} /fast_double_parser-config.cmake"
42
+ INSTALL_DESTINATION "share/fast_double_parser"
43
+ )
44
+ install (
45
+ FILES "${CMAKE_CURRENT_BINARY_DIR} /fast_double_parser-config.cmake"
46
+ DESTINATION "share/fast_double_parser"
47
+ )
48
+
49
+ option (BUILD_TESTING "Build unit tests" ON )
50
+ if (BUILD_TESTING)
51
+ add_executable (unit ${unit_src} ${bogus_src} ${rebogus_src} )
52
+
53
+ if (FAST_DOUBLE_PARSER_SANITIZE)
54
+ target_compile_options (unit PUBLIC -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all )
55
+ target_link_options (unit PUBLIC -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all )
56
+ # Ubuntu bug for GCC 5.0+ (safe for all versions)
57
+ if (CMAKE_COMPILER_IS_GNUCC AND NOT APPLE )
58
+ target_link_libraries (unit PUBLIC -fuse-ld=gold)
59
+ endif ()
60
+ endif ()
61
+ target_link_libraries (unit PRIVATE fast_double_parser)
24
62
25
- add_executable (unit ${unit_src} ${bogus_src} ${rebogus_src} )
26
- if (FAST_DOUBLE_PARSER_SANITIZE)
27
- target_compile_options (unit PUBLIC -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all )
28
- target_link_options (unit PUBLIC -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all )
29
- # Ubuntu bug for GCC 5.0+ (safe for all versions)
30
- if (CMAKE_COMPILER_IS_GNUCC AND NOT APPLE )
31
- target_link_libraries (unit PUBLIC -fuse-ld=gold)
32
- endif ()
63
+ enable_testing ()
64
+ add_test (unit unit)
33
65
endif ()
34
66
35
- target_link_libraries (unit PUBLIC fast_double_parser)
36
-
37
-
38
-
39
- enable_testing ()
40
- add_test (unit unit)
41
-
42
67
option (FAST_DOUBLE_BENCHMARKS "include benchmarks" OFF )
43
68
44
-
45
-
46
69
function (initialize_submodule DIRECTORY )
47
70
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR} /${DIRECTORY} /.git)
48
71
find_package (Git QUIET REQUIRED)
@@ -63,8 +86,6 @@ if(FAST_DOUBLE_BENCHMARKS)
63
86
add_subdirectory (benchmarks/dependencies/abseil-cpp)
64
87
add_subdirectory (benchmarks/dependencies/double-conversion)
65
88
66
-
67
-
68
89
add_executable (benchmark ${benchmark_src} )
69
90
target_link_libraries (benchmark PUBLIC double-conversion absl_strings)
70
91
target_include_directories (benchmark PUBLIC include )
0 commit comments