summaryrefslogtreecommitdiff
path: root/Modules/FindMFC.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/FindMFC.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/FindMFC.cmake')
-rw-r--r--Modules/FindMFC.cmake10
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake
index 0574ab5531..2d5de89147 100644
--- a/Modules/FindMFC.cmake
+++ b/Modules/FindMFC.cmake
@@ -29,21 +29,19 @@ endif()
if(MFC_ATTEMPT_TRY_COMPILE)
if(NOT DEFINED MFC_HAVE_MFC)
set(CHECK_INCLUDE_FILE_VAR "afxwin.h")
- configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
+ file(READ ${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in _CIF_SOURCE_CONTENT)
+ string(CONFIGURE "${_CIF_SOURCE_CONTENT}" _CIF_SOURCE_CONTENT)
message(CHECK_START "Looking for MFC")
# Try both shared and static as the root project may have set the /MT flag
try_compile(MFC_HAVE_MFC
- SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
+ SOURCE_FROM_VAR CheckIncludeFile.cxx _CIF_SOURCE_CONTENT
CMAKE_FLAGS
-DCMAKE_MFC_FLAG:STRING=2
-DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
OUTPUT_VARIABLE OUTPUT)
if(NOT MFC_HAVE_MFC)
- configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
try_compile(MFC_HAVE_MFC
- SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
+ SOURCE_FROM_VAR CheckIncludeFile.cxx _CIF_SOURCE_CONTENT
CMAKE_FLAGS
-DCMAKE_MFC_FLAG:STRING=1
OUTPUT_VARIABLE OUTPUT)