mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 20:04:27 +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()
|
endif()
|
||||||
|
|
||||||
if(UNITS_DOWNCAST_MODE STREQUAL "AUTO")
|
if(DEFINED UNITS_DOWNCAST_MODE)
|
||||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=AUTOMATIC")
|
set(downcast_mode_options OFF ON AUTO)
|
||||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=2)
|
list(FIND downcast_mode_options "${UNITS_DOWNCAST_MODE}" downcast_mode)
|
||||||
elseif(UNITS_DOWNCAST_MODE)
|
if(downcast_mode EQUAL -1)
|
||||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=ON")
|
message(FATAL_ERROR "'${UNITS_DOWNCAST_MODE}' is an invalid UNITS_DOWNCAST_MODE value")
|
||||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=1)
|
else()
|
||||||
else()
|
message(STATUS "Configuring UNITS_DOWNCAST_MODE=${UNITS_DOWNCAST_MODE}")
|
||||||
message(STATUS "Configuring UNITS_DOWNCAST_MODE=OFF")
|
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=${downcast_mode})
|
||||||
target_compile_definitions(mp-units INTERFACE UNITS_DOWNCAST_MODE=0)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(mp::units ALIAS mp-units)
|
add_library(mp::units ALIAS mp-units)
|
||||||
|
Reference in New Issue
Block a user