summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-29 15:27:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-11-29 15:27:26 (GMT)
commit5618eeef938e7b15e6fb4139e9970f8b926cedba (patch)
treef2904b2bae863799a911e3b7f469ec83f95556d2
parentbdc4a4973330cad8fadd81cd4929dacd73595063 (diff)
parentf6b99c5087e1dfae29efc5146508e8b8b8b59b29 (diff)
downloadCMake-5618eeef938e7b15e6fb4139e9970f8b926cedba.zip
CMake-5618eeef938e7b15e6fb4139e9970f8b926cedba.tar.gz
CMake-5618eeef938e7b15e6fb4139e9970f8b926cedba.tar.bz2
Merge topic 'source-from-var'
f6b99c5087 Check*: Restore support for arbitrary result variable names Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7960
-rw-r--r--Modules/CheckIncludeFiles.cmake5
-rw-r--r--Modules/CheckTypeSize.cmake5
2 files changed, 6 insertions, 4 deletions
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 8e82859..8fc6921 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -70,10 +70,11 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
endif()
+ string(MAKE_C_IDENTIFIER ${VARIABLE} _variable_escaped)
if(_lang STREQUAL "C")
- set(src ${VARIABLE}.c)
+ set(src ${_variable_escaped}.c)
elseif(_lang STREQUAL "CXX")
- set(src ${VARIABLE}.cpp)
+ set(src ${_variable_escaped}.cpp)
else()
message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
endif()
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index b14ab06..e09b7c8 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -103,10 +103,11 @@ function(__check_type_size_impl type var map builtin language)
endif()
# Perform language check
+ string(MAKE_C_IDENTIFIER ${var} _var_escaped)
if(language STREQUAL "C")
- set(src ${var}.c)
+ set(src ${_var_escaped}.c)
elseif(language STREQUAL "CXX")
- set(src ${var}.cpp)
+ set(src ${_var_escaped}.cpp)
else()
message(FATAL_ERROR "Unknown language:\n ${language}\nSupported languages: C, CXX.\n")
endif()