Created
September 16, 2020 00:39
-
-
Save mistydemeo/daf7d4c13106da0685ebb9c58feec859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 37e3d48948f27f09d9ba31d8c6acb765b7abf12b Mon Sep 17 00:00:00 2001 | |
From: Misty De Meo <[email protected]> | |
Date: Tue, 15 Sep 2020 17:30:46 -0700 | |
Subject: [PATCH] FindSSE: ensure ${CPUINFO} is quoted | |
If ${CPUINFO} isn't quoted, and it's an empty string, CMake's STRING | |
REPLACE function will error with a note it's being called with too few | |
arguments. Fixes: | |
CMake Error at CMakeModules/FindSSE.cmake:47 (STRING): | |
STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to | |
command. | |
Call Stack (most recent call first): | |
CMakeLists.txt:8 (include) | |
--- | |
CMakeModules/FindSSE.cmake | 18 +++++++++--------- | |
1 file changed, 9 insertions(+), 9 deletions(-) | |
diff --git a/CMakeModules/FindSSE.cmake b/CMakeModules/FindSSE.cmake | |
index 6ece876..f6ad475 100644 | |
--- a/CMakeModules/FindSSE.cmake | |
+++ b/CMakeModules/FindSSE.cmake | |
@@ -4,7 +4,7 @@ | |
IF(CMAKE_SYSTEM_NAME MATCHES "Linux") | |
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) | |
- STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) | |
IF (SSE2_TRUE) | |
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | |
@@ -13,14 +13,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") | |
ENDIF (SSE2_TRUE) | |
# /proc/cpuinfo apparently omits sse3 :( | |
- STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE) | |
IF (NOT SSE3_TRUE) | |
- STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE) | |
ENDIF (NOT SSE3_TRUE) | |
- STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE) | |
IF (SSE3_TRUE OR SSSE3_TRUE) | |
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") | |
@@ -33,7 +33,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") | |
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | |
ENDIF (SSSE3_TRUE) | |
- STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE) | |
IF (SSE41_TRUE) | |
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") | |
@@ -44,7 +44,7 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") | |
EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE | |
CPUINFO) | |
- STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE) | |
IF (SSE2_TRUE) | |
set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") | |
@@ -52,7 +52,7 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") | |
set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") | |
ENDIF (SSE2_TRUE) | |
- STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE) | |
IF (SSE3_TRUE) | |
set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") | |
@@ -60,7 +60,7 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") | |
set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") | |
ENDIF (SSE3_TRUE) | |
- STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE) | |
IF (SSSE3_TRUE) | |
set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") | |
@@ -68,7 +68,7 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") | |
set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") | |
ENDIF (SSSE3_TRUE) | |
- STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO}) | |
+ STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE "${CPUINFO}") | |
STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE) | |
IF (SSE41_TRUE) | |
set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") | |
-- | |
2.28.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment