forked from jk-jeon/dragonbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
42 lines (35 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(dragonbox_meta LANGUAGES CXX)
include(FetchContent)
if (NOT TARGET dragonbox)
FetchContent_Declare(dragonbox SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
FetchContent_MakeAvailable(dragonbox)
endif()
if (NOT TARGET common)
FetchContent_Declare(common SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../common")
FetchContent_MakeAvailable(common)
endif()
function(meta_exe NAME)
add_executable(${NAME} source/${NAME}.cpp)
target_compile_features(${NAME} PRIVATE cxx_std_17)
target_link_libraries(${NAME} PRIVATE ${ARGN})
# ---- MSVC Specifics ----
if (MSVC)
# No need to not generate PDB
# /permissive- should be the default
# The compilation will fail without /experimental:newLambdaProcessor
# See also https://gitlab.kitware.com/cmake/cmake/-/issues/16478
target_compile_options(${NAME} PUBLIC
/Zi /permissive-
$<$<NOT:$<CXX_COMPILER_ID:Clang>>:/experimental:newLambdaProcessor>
$<$<CONFIG:Release>:/GL>)
target_link_options(${NAME} PUBLIC /LTCG /DEBUG:FASTLINK)
set_target_properties(${NAME} PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
endif()
endfunction()
meta_exe(generate_cache dragonbox::common)
meta_exe(generate_compressed_cache_error_table dragonbox::dragonbox)
meta_exe(live_test dragonbox::dragonbox_to_chars)
meta_exe(perf_test dragonbox::common dragonbox::dragonbox_to_chars)
meta_exe(sandbox dragonbox::dragonbox)