mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 03:14:29 +02:00
build: UNITS_DOWNCAST_MODE handling in CMake refactored
This commit is contained in:
@@ -67,15 +67,15 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNITS_DOWNCAST_MODE STREQUAL "AUTO")
|
||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=AUTOMATIC")
|
||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=2)
|
||||
elseif(UNITS_DOWNCAST_MODE)
|
||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=ON")
|
||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=1)
|
||||
else()
|
||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=OFF")
|
||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=0)
|
||||
if(DEFINED UNITS_DOWNCAST_MODE)
|
||||
set(downcast_mode_options OFF ON AUTO)
|
||||
list(FIND downcast_mode_options "${UNITS_DOWNCAST_MODE}" downcast_mode)
|
||||
if(downcast_mode EQUAL -1)
|
||||
message(FATAL_ERROR "'${UNITS_DOWNCAST_MODE}' is an invalid UNITS_DOWNCAST_MODE value")
|
||||
else()
|
||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=${UNITS_DOWNCAST_MODE}")
|
||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=${downcast_mode})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(mp::units ALIAS mp-units)
|
||||
|
Reference in New Issue
Block a user