mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
🔨 Introduce FASTFLOAT_INSTALL to make install optional
When using fast_float as a PRIVATE dependency, it is not required to install it. This flag give user using fastfloat with add_subdirectory the opportunity to disable install target Default behavior is conserved since FASTFLOAT_INSTALL is ON
This commit is contained in:
parent
bc3be12530
commit
3c1190cd85
@ -22,13 +22,18 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(FASTFLOAT_INSTALL "Enable install" ON)
|
||||
|
||||
if(FASTFLOAT_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
endif()
|
||||
|
||||
add_library(fast_float INTERFACE)
|
||||
target_include_directories(
|
||||
fast_float
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
if(FASTFLOAT_SANITIZE)
|
||||
target_compile_options(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all)
|
||||
@ -42,7 +47,7 @@ if(MSVC_VERSION GREATER 1910)
|
||||
endif()
|
||||
|
||||
|
||||
include(GNUInstallDirs)
|
||||
if(FASTFLOAT_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(FASTFLOAT_VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/module/FastFloatConfigVersion.cmake")
|
||||
@ -68,3 +73,4 @@ install(TARGETS fast_float
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user