diff options
author | David Cole <david.cole@kitware.com> | 2011-11-02 12:03:12 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2011-11-02 12:03:12 (GMT) |
commit | b297da615aa2331a558a1c9aa8864e4db3e1f39a (patch) | |
tree | 65455d9d3263955e3c633c0860e239da61b9a154 /Tests/MFC | |
parent | 54595e6d89a6280dfbc9580500ce50283ce71d3f (diff) | |
download | CMake-b297da615aa2331a558a1c9aa8864e4db3e1f39a.zip CMake-b297da615aa2331a558a1c9aa8864e4db3e1f39a.tar.gz CMake-b297da615aa2331a558a1c9aa8864e4db3e1f39a.tar.bz2 |
Tests: Fix MFC test w/ Make-based generators (#11213)
An explicit add_definitions of _AFXDLL is required for shared
library builds with non-Visual Studio generators.
Diffstat (limited to 'Tests/MFC')
-rw-r--r-- | Tests/MFC/CMakeLists.txt.in | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in index 06ba8b3..e6bfabd 100644 --- a/Tests/MFC/CMakeLists.txt.in +++ b/Tests/MFC/CMakeLists.txt.in @@ -6,15 +6,23 @@ macro(replace_flags var these those) string(REGEX REPLACE "${these}" "${those}" ${var} "${${var}}") #message(STATUS "info: ${var} changed to '${${var}}'") endif() + message(STATUS "info: ${var}='${${var}}'") endmacro() macro(msvc_link_to_static_crt) if(MSVC) + set(has_correct_flag 0) foreach(lang C CXX) foreach(suffix "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO) replace_flags("CMAKE_${lang}_FLAGS${suffix}" "/MD" "/MT") + if(CMAKE_${lang}_FLAGS${suffix} MATCHES "/MT") + set(has_correct_flag 1) + endif() endforeach() endforeach() + if(NOT has_correct_flag) + message(FATAL_ERROR "no CMAKE_*_FLAGS var contains /MT") + endif() endif() endmacro() @@ -39,6 +47,10 @@ set(CMAKE_MFC_FLAG "@CMAKE_MFC_FLAG_VALUE@") if("${CMAKE_MFC_FLAG}" STREQUAL "1") msvc_link_to_static_crt() +else() + # VS generators add this automatically based on the CMAKE_MFC_FLAG value, + # but generators matching "Make" require: + add_definitions(-D_AFXDLL) endif() add_executable(mfc1 WIN32 ${files}) |