From 64056ee3212a037bc9b71b243fd3436fbfb0b459 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 19 Sep 2024 14:50:32 -0600 Subject: [PATCH] build: `target_compile_features` now uses `CMAKE_CXX_STANDARD` --- src/cmake/AddMPUnitsModule.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cmake/AddMPUnitsModule.cmake b/src/cmake/AddMPUnitsModule.cmake index df551f09e..279899b1d 100644 --- a/src/cmake/AddMPUnitsModule.cmake +++ b/src/cmake/AddMPUnitsModule.cmake @@ -64,7 +64,13 @@ function(add_mp_units_module name target_name) # define the target for a module add_library(${target_name} ${SCOPE}) - target_compile_features(${target_name} ${${projectPrefix}TARGET_SCOPE} cxx_std_20) + + if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD GREATER 20) + # TODO revise when a fixed version of CMake is released + target_compile_features(${target_name} ${${projectPrefix}TARGET_SCOPE} cxx_std_${CMAKE_CXX_STANDARD}) + else() + target_compile_features(${target_name} ${${projectPrefix}TARGET_SCOPE} cxx_std_20) + endif() target_link_libraries(${target_name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES}) set_target_properties(${target_name} PROPERTIES EXPORT_NAME ${name})