summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-04 13:08:10 +0000
committerKitware Robot <kwrobot@kitware.com>2022-02-04 08:08:23 -0500
commit3900a31f440a1111f07ea893b146a67778e918c2 (patch)
tree85e702e93e22196944cc4ece652228e86bd416e0
parent793c3dcabc1f0c7a5e4d920bd6affc46a47c1afc (diff)
parent9d621ceba115a409ca58e8c59fba365f55fd6d26 (diff)
downloadcmake-3900a31f440a1111f07ea893b146a67778e918c2.tar.gz
Merge topic 'test-mfc-explicit' into release-3.23
9d621ceba1 Tests: Run MFC test only when explicitly enabled Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6943
-rw-r--r--.gitlab/ci/configure_windows_vs_common.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs_common_ninja.cmake1
-rw-r--r--Tests/CMakeLists.txt104
-rw-r--r--Utilities/Release/win/x86/cache-i386.txt3
-rw-r--r--Utilities/Release/win/x86/cache-x86_64.txt3
-rwxr-xr-xUtilities/Release/win/x86/test/test-ninja.bat1
-rwxr-xr-xUtilities/Release/win/x86/test/test-nmake.bat1
7 files changed, 3 insertions, 111 deletions
diff --git a/.gitlab/ci/configure_windows_vs_common.cmake b/.gitlab/ci/configure_windows_vs_common.cmake
index 703f5348e4..962f03db9f 100644
--- a/.gitlab/ci/configure_windows_vs_common.cmake
+++ b/.gitlab/ci/configure_windows_vs_common.cmake
@@ -5,5 +5,6 @@ set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_Fortran "OFF" CACHE BOOL "")
set(CMake_TEST_Java OFF CACHE BOOL "")
+set(CMake_TEST_MFC "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_vs_common_ninja.cmake b/.gitlab/ci/configure_windows_vs_common_ninja.cmake
index ae73f8352c..1ae1a66bd4 100644
--- a/.gitlab/ci/configure_windows_vs_common_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs_common_ninja.cmake
@@ -8,5 +8,6 @@ set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_Fortran "OFF" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_MFC "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake")
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index da6219e763..6946ffbb86 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2107,109 +2107,7 @@ if(BUILD_TESTING)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
endif()
- if(NOT DEFINED CTEST_RUN_MFC)
- set(CTEST_RUN_MFC OFF)
-
- if(MSVC)
- set(CTEST_RUN_MFC ON)
-
- # Look for evidence that this is a VCExpress build. If so, avoid
- # the MFC test by default.
- string(TOLOWER "${CMAKE_MAKE_PROGRAM}" mkprog)
- if(mkprog MATCHES "vcexpress")
- message(STATUS
- "CMAKE_MAKE_PROGRAM indicates vcexpress, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- endif()
-
- # Since MSBuild might also be the "makeprogram" for a VCExpress
- # build tree, use one more heuristic, too. The string representing
- # the .vcproj file type contains "VCExpress" on machines where an
- # express edition of VS was installed last:
- if(CTEST_RUN_MFC)
- execute_process(COMMAND cmd /c assoc .vcproj
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE ov)
- if(ov MATCHES "VCExpress")
- message(STATUS
- ".vcproj file association indicates VCExpress, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- elseif( NOT ov )
- message(STATUS
- ".vcproj has no file association, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- endif()
- endif()
-
- if(CTEST_RUN_MFC)
- # For the Watcom WMake generator, avoid the MFC test by default.
- if("${CMAKE_GENERATOR}" MATCHES "WMake")
- message(STATUS
- "using the Watcom WMake generator, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
- # clang-cl cannot deal with implicit dependencies in UTF16 files
- # (see #18311). IntelLLVM inherits this behavior from Clang.
- # TODO: maybe clang should also skip the MFC test
- message(STATUS
- "using generator other than Visual Studio with clang-cl, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- endif()
- endif()
-
- # Last resort, after quick checks are done. Do a try_compile, and avoid
- # the MFC test if the simplest possible MFC app cannot be compiled.
- if(CTEST_RUN_MFC AND NOT DEFINED HAVE_MFC)
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/MFC/try_compile/CMakeLists.txt
- ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/CMakeLists.txt
- COPYONLY
- )
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/MFC/mfc1/stdafx.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/stdafx.cpp
- COPYONLY
- )
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/MFC/mfc1/stdafx.h
- ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/stdafx.h
- COPYONLY
- )
-
- message(STATUS "Looking for MFC")
-
- try_compile(HAVE_MFC
- ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile/build
- ${CMAKE_CURRENT_BINARY_DIR}/MFC/try_compile
- try_compile_mfc
- OUTPUT_VARIABLE HAVE_MFC_OUTPUT)
-
- if(HAVE_MFC)
- message(STATUS "Looking for MFC - found")
- set(HAVE_MFC 1 CACHE INTERNAL "Have MFC")
- file(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if MFC exists passed with the following output:\n"
- "${HAVE_MFC_OUTPUT}\n\n")
- else()
- message(STATUS "Looking for MFC - not found")
- set(HAVE_MFC "" CACHE INTERNAL "Have MFC")
- file(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if MFC exists failed with the following output:\n"
- "${HAVE_MFC_OUTPUT}\n\n")
- endif()
- endif()
-
- if(CTEST_RUN_MFC AND NOT HAVE_MFC)
- message(STATUS
- "cannot compile simplest ever MFC app, avoiding MFC test")
- set(CTEST_RUN_MFC OFF)
- endif()
- endif()
- endif()
-
- if(CTEST_RUN_MFC)
+ if(CMake_TEST_MFC)
add_test(MFC ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/MFC"
diff --git a/Utilities/Release/win/x86/cache-i386.txt b/Utilities/Release/win/x86/cache-i386.txt
index 54a45d8fc4..2dcd4dd3a3 100644
--- a/Utilities/Release/win/x86/cache-i386.txt
+++ b/Utilities/Release/win/x86/cache-i386.txt
@@ -29,9 +29,6 @@ QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-i386/bin/qhelpgenerator.exe
# No bootstrap with MSVC tools.
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-# No MFC in base image.
-CTEST_RUN_MFC:BOOL=OFF
-
# No Fortran compiler.
CMAKE_Fortran_COMPILER:FILEPATH=FALSE
diff --git a/Utilities/Release/win/x86/cache-x86_64.txt b/Utilities/Release/win/x86/cache-x86_64.txt
index 0b78c72b9c..3c5593e15b 100644
--- a/Utilities/Release/win/x86/cache-x86_64.txt
+++ b/Utilities/Release/win/x86/cache-x86_64.txt
@@ -29,9 +29,6 @@ QCOLLECTIONGENERATOR_EXECUTABLE:PATH=C:/qt-x86_64/bin/qhelpgenerator.exe
# No bootstrap with MSVC tools.
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
-# No MFC in base image.
-CTEST_RUN_MFC:BOOL=OFF
-
# No Fortran compiler.
CMAKE_Fortran_COMPILER:FILEPATH=FALSE
diff --git a/Utilities/Release/win/x86/test/test-ninja.bat b/Utilities/Release/win/x86/test/test-ninja.bat
index b8347efc62..fb43589128 100755
--- a/Utilities/Release/win/x86/test/test-ninja.bat
+++ b/Utilities/Release/win/x86/test/test-ninja.bat
@@ -12,7 +12,6 @@ cd \cmake\src\cmake-ninja && ^
@echo CMake_TEST_IPO_WORKS_C:BOOL=ON
@echo CMake_TEST_IPO_WORKS_CXX:BOOL=ON
@echo CMake_TEST_NO_NETWORK:BOOL=ON
- @echo CTEST_RUN_MFC:BOOL=OFF
) && ^
cmake ..\cmake -DCMake_TEST_HOST_CMAKE=1 -G "Ninja" && ^
ninja && ^
diff --git a/Utilities/Release/win/x86/test/test-nmake.bat b/Utilities/Release/win/x86/test/test-nmake.bat
index 5008711ac4..9d7e447891 100755
--- a/Utilities/Release/win/x86/test/test-nmake.bat
+++ b/Utilities/Release/win/x86/test/test-nmake.bat
@@ -12,7 +12,6 @@ cd \cmake\src\cmake-nmake && ^
@echo CMake_TEST_IPO_WORKS_C:BOOL=ON
@echo CMake_TEST_IPO_WORKS_CXX:BOOL=ON
@echo CMake_TEST_NO_NETWORK:BOOL=ON
- @echo CTEST_RUN_MFC:BOOL=OFF
) && ^
cmake ..\cmake -DCMake_TEST_HOST_CMAKE=1 -G "NMake Makefiles" && ^
nmake && ^