mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
feat: add TOML11_ENABLE_ACCESS_CHECK macro
This commit is contained in:
@@ -17,6 +17,7 @@ project(toml11 LANGUAGES CXX VERSION "${TOML11_VERSION_MAJOR}.${TOML11_VERSION_M
|
||||
include(CTest) # to use ${BUILD_TESTING}
|
||||
|
||||
option(TOML11_PRECOMPILE "precompile toml11 library" OFF)
|
||||
option(TOML11_ENABLE_ACCESS_CHECK "enable access check feature (beta)" OFF)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
cmake_policy(PUSH)
|
||||
|
@@ -90,7 +90,10 @@ if(TOML11_PRECOMPILE)
|
||||
types.cpp
|
||||
value_t.cpp
|
||||
)
|
||||
target_compile_definitions(toml11 PUBLIC -DTOML11_COMPILE_SOURCES)
|
||||
target_compile_definitions(toml11 PUBLIC
|
||||
-DTOML11_COMPILE_SOURCES
|
||||
$<$<BOOL:${TOML11_ENABLE_ACCESS_CHECK}>: -DTOML11_ENABLE_ACCESS_CHECK>
|
||||
)
|
||||
target_include_directories(toml11 PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
@@ -127,6 +130,9 @@ if(TOML11_PRECOMPILE)
|
||||
endif()
|
||||
else()
|
||||
add_library(toml11 INTERFACE)
|
||||
target_compile_definitions(toml11 INTERFACE
|
||||
$<$<BOOL:${TOML11_ENABLE_ACCESS_CHECK}>: -DTOML11_ENABLE_ACCESS_CHECK>
|
||||
)
|
||||
target_include_directories(toml11 INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
|
Reference in New Issue
Block a user