diff options
author | David Cole <david.cole@kitware.com> | 2011-10-24 20:55:52 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2011-11-01 14:08:58 (GMT) |
commit | 36b0c432cf5804ec45367066e34f4c38165d5c09 (patch) | |
tree | 0c318628e7990a2e43b2f8a186f997b537a9f95f /Tests/MFC/CMakeLists.txt.in | |
parent | 89742d73cc684a78586fad2497048d9329c1160e (diff) | |
download | CMake-36b0c432cf5804ec45367066e34f4c38165d5c09.zip CMake-36b0c432cf5804ec45367066e34f4c38165d5c09.tar.gz CMake-36b0c432cf5804ec45367066e34f4c38165d5c09.tar.bz2 |
Tests: Add the MFC test (#11213)
Build a simple, do-nothing VS 7.1 MFC wizard generated app
with CMake.
Build it two different ways via ExternalProject, one with
CMAKE_MFC_FLAG set to 1 for linking to MFC statically, and
one with CMAKE_MFC_FLAG set to 2 for linking to the shared
MFC dlls.
Validate that the install tree of the static build has only
one *.exe file in it and nothing else. Also validate that the
install tree of the shared library build has multiple files in
it (no less than 3) and that they are only of the expected types
*.exe, *.dll and *.manifest.
This commit does not address the issue reported in #11213,
it merely adds a test that may be used to show that the
bug report is valid. After this commit, the MFC test should
fail on any dashboard machines that have MSVC defined, but
cannot build an MFC app. We can then analyze that failure
data as input to solving the issue.
Diffstat (limited to 'Tests/MFC/CMakeLists.txt.in')
-rw-r--r-- | Tests/MFC/CMakeLists.txt.in | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in new file mode 100644 index 0000000..06ba8b3 --- /dev/null +++ b/Tests/MFC/CMakeLists.txt.in @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 2.8) +project(mfc1) + +macro(replace_flags var these those) + if("${${var}}" MATCHES "${these}") + string(REGEX REPLACE "${these}" "${those}" ${var} "${${var}}") + #message(STATUS "info: ${var} changed to '${${var}}'") + endif() +endmacro() + +macro(msvc_link_to_static_crt) + if(MSVC) + foreach(lang C CXX) + foreach(suffix "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO) + replace_flags("CMAKE_${lang}_FLAGS${suffix}" "/MD" "/MT") + endforeach() + endforeach() + endif() +endmacro() + +set(files + ChildFrm.cpp + ChildFrm.h + MainFrm.cpp + MainFrm.h + mfc1.cpp + mfc1.h + mfc1.rc + mfc1Doc.cpp + mfc1Doc.h + mfc1View.cpp + mfc1View.h + Resource.h + stdafx.cpp + stdafx.h +) + +set(CMAKE_MFC_FLAG "@CMAKE_MFC_FLAG_VALUE@") + +if("${CMAKE_MFC_FLAG}" STREQUAL "1") + msvc_link_to_static_crt() +endif() + +add_executable(mfc1 WIN32 ${files}) +install(TARGETS mfc1 DESTINATION bin) + +if("${CMAKE_MFC_FLAG}" STREQUAL "2") + set(CMAKE_INSTALL_MFC_LIBRARIES ON) + include(InstallRequiredSystemLibraries) +endif() |