build: got rid of global options for references and literals
This commit is contained in:
1 parent
b3b52148c0
commit
512406e900
15 files changed
+10
-76
No files matched your search
@@ -27,12 +27,7 @@ project(mp-units
|
||||
)
|
||||
|
||||
option(UNITS_AS_SYSTEM_HEADERS "Exports library as system headers" OFF)
|
||||
option(UNITS_REFERENCES "Enables definitions of Quantity References provided for quantities of various units" ON)
|
||||
option(UNITS_LITERALS "Enables definitions of User Defined Literals (UDLs) provided for quantities of various units" OFF)
|
||||
|
||||
message(STATUS "UNITS_AS_SYSTEM_HEADERS: ${UNITS_AS_SYSTEM_HEADERS}")
|
||||
message(STATUS "UNITS_REFERENCES: ${UNITS_REFERENCES}")
|
||||
message(STATUS "UNITS_LITERALS: ${UNITS_LITERALS}")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
|
||||
@@ -38,15 +38,3 @@ function(add_units_module name)
|
||||
install(TARGETS mp-units-${name} EXPORT mp-unitsTargets)
|
||||
install(DIRECTORY include/units TYPE INCLUDE)
|
||||
endfunction()
|
||||
|
||||
|
||||
#
|
||||
# add_units_systems(ModuleName <depependencies>...)
|
||||
#
|
||||
function(add_units_system name)
|
||||
add_units_module(${name} ${ARGN})
|
||||
target_compile_definitions(mp-units-${name} INTERFACE
|
||||
$<$<BOOL:${UNITS_REFERENCES}>:UNITS_REFERENCES>
|
||||
$<$<BOOL:${UNITS_LITERALS}>:UNITS_LITERALS>
|
||||
)
|
||||
endfunction()
|
||||
@@ -55,11 +55,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(mp-units-core INTERFACE
|
||||
$<$<BOOL:${UNITS_REFERENCES}>:UNITS_REFERENCES>
|
||||
$<$<BOOL:${UNITS_LITERALS}>:UNITS_LITERALS>
|
||||
)
|
||||
|
||||
if(DEFINED UNITS_DOWNCAST_MODE)
|
||||
set(downcast_mode_options OFF ON AUTO)
|
||||
list(FIND downcast_mode_options "${UNITS_DOWNCAST_MODE}" downcast_mode)
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(isq-iec80000 mp-units::si)
|
||||
add_units_module(isq-iec80000 mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(isq-natural mp-units::isq)
|
||||
add_units_module(isq-natural mp-units::isq)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-cgs mp-units::si)
|
||||
add_units_module(si-cgs mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-fps mp-units::si)
|
||||
add_units_module(si-fps mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-iau mp-units::si)
|
||||
add_units_module(si-iau mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-imperial mp-units::si)
|
||||
add_units_module(si-imperial mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-international mp-units::si)
|
||||
add_units_module(si-international mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-typographic mp-units::si)
|
||||
add_units_module(si-typographic mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si-us mp-units::si)
|
||||
add_units_module(si-us mp-units::si)
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_system(si mp-units::isq)
|
||||
add_units_module(si mp-units::isq)
|
||||
Reference in new issue
Block a user