summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCCompilerId.c.in6
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in6
-rw-r--r--Modules/CMakePlatformId.h.in6
3 files changed, 15 insertions, 3 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index d5ae00a5d6..ecbe431b70 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -75,6 +75,10 @@ int main() { return 0; }
#endif
-char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 7bdb5e0084..060c7e9c16 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -63,6 +63,10 @@ int main() { return 0; }
#endif
-char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index f62eb36fa2..1f1fca6ff8 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -76,4 +76,8 @@
#endif
-char info_platform[] = "INFO:platform[" PLATFORM_ID "]";
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";