Skip to content

Commit

Permalink
Revert CMake version bump, but instead add header files into INTERFAC…
Browse files Browse the repository at this point in the history
…E projects if version >= 3.19
  • Loading branch information
jk-jeon committed Aug 28, 2024
1 parent 1dee717 commit 0f8eb32
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 12 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(dragonbox
VERSION 1.1.3
Expand All @@ -21,7 +21,11 @@ endif()

set(dragonbox_headers include/dragonbox/dragonbox.h)

add_library(dragonbox INTERFACE ${dragonbox_headers})
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
add_library(dragonbox INTERFACE ${dragonbox_headers})
else()
add_library(dragonbox INTERFACE)
endif()
add_library(dragonbox::dragonbox ALIAS dragonbox)

target_include_directories(dragonbox
Expand All @@ -33,7 +37,13 @@ target_compile_features(dragonbox INTERFACE cxx_std_17)

# ---- Declare library (dragonbox_to_chars) ----

set(dragonbox_to_chars_headers include/dragonbox/dragonbox_to_chars.h)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
set(dragonbox_to_chars_headers include/dragonbox/dragonbox_to_chars.h)
else()
set(dragonbox_to_chars_headers
${dragonbox_headers}
include/dragonbox/dragonbox_to_chars.h)
endif()

set(dragonbox_to_chars_sources source/dragonbox_to_chars.cpp)

Expand Down
2 changes: 1 addition & 1 deletion subproject/3rdparty/grisu_exact/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(grisu_exact LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion subproject/3rdparty/ryu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(ryu_cmake LANGUAGES C)

Expand Down
2 changes: 1 addition & 1 deletion subproject/3rdparty/schubfach/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(schubfach LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion subproject/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(benchmark LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion subproject/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(dragonbox_common LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion subproject/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(dragonbox_meta LANGUAGES CXX)

Expand Down
8 changes: 6 additions & 2 deletions subproject/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(dragonbox_simple LANGUAGES CXX)

set(dragonbox_simple_headers include/simple_dragonbox.h)

add_library(dragonbox_simple INTERFACE ${dragonbox_simple_headers})
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
add_library(dragonbox_simple INTERFACE ${dragonbox_simple_headers})
else()
add_library(dragonbox_simple INTERFACE)
endif()
add_library(dragonbox::simple ALIAS dragonbox_simple)

target_include_directories(dragonbox_simple
Expand Down
2 changes: 1 addition & 1 deletion subproject/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(dragonboxTests LANGUAGES CXX)

Expand Down

0 comments on commit 0f8eb32

Please sign in to comment.