From aefd149f0ace9307b2fef2e8d803472d2b5a3622 Mon Sep 17 00:00:00 2001 From: Istvan Haller <31476121+ihaller@users.noreply.github.com> Date: Fri, 28 May 2021 17:13:49 +0100 Subject: [PATCH] Gated the mcx16 flag to C++ compilation (#332) * Restricted mcx16 option to C++ files as only those can include the snmalloc header --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfb1c13..3db4d7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,13 +117,13 @@ if(NOT MSVC) target_link_libraries(snmalloc_lib INTERFACE atomic) endif() if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) # XXX elseif ARM? endif() endif() @@ -143,13 +143,13 @@ endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + target_compile_options(snmalloc_lib INTERFACE $<$:-mcx16>) endif() endif ()