summaryrefslogtreecommitdiff
path: root/Modules/CheckPrototypeDefinition.cmake
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2022-09-26 16:12:57 -0400
committerMatthew Woehlke <matthew.woehlke@kitware.com>2022-09-27 13:29:52 -0400
commit41f7b1169a0b3e86506ac9c6d8f2664997cd340c (patch)
tree437327cc528d41c1a69c08600c629d720cf78e7e /Modules/CheckPrototypeDefinition.cmake
parentdb76876db5c16d610efd08f6deb0e4c9cd0e5603 (diff)
downloadcmake-41f7b1169a0b3e86506ac9c6d8f2664997cd340c.tar.gz
Modules: Use new SOURCES_FROM_* try_compile (2/2)
Modify some additional modules that ship with CMake to use the new SOURCES_FROM_* arguments to try_compile / try_run as added by commits cb14ae2b87 (try_compile: Add SOURCE_FROM_{ARG,VAR}, 2022-09-21) and 611d801790 (try_compile: Add SOURCE_FROM_FILE, 2022-09-22). This covers modules that need to read and alter a template source file, which were not addressed in the previous commit. Note that FindOpenACC.cmake does not actually need configure_file functionality; it appears to have inherited the (gratuitous) use thereof from FindOpenMP.cmake, with which its code bears significant similarity.
Diffstat (limited to 'Modules/CheckPrototypeDefinition.cmake')
-rw-r--r--Modules/CheckPrototypeDefinition.cmake8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index 5a075020fe..12f4e8684c 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -94,13 +94,11 @@ function(check_prototype_definition _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
- configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in"
- "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
-
- file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
+ file(READ ${__check_proto_def_dir}/CheckPrototypeDefinition.c.in _SOURCE)
+ string(CONFIGURE "${_SOURCE}" _SOURCE @ONLY)
try_compile(${_VARIABLE}
- SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
+ SOURCE_FROM_VAR CheckPrototypeDefinition.c _SOURCE
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
${CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS}
${CHECK_PROTOTYPE_DEFINITION_LIBS}